Windows Azure 클라우드 서비스를 처음 사용합니다. ServiceStack을 사용하여 작성된 서비스를 작업자 역할에 호스팅하려고합니다. 다음과 같은 방법을 시도했지만 성공하지 못했습니다.Windows Azure 작업자 역할을 사용하는 ServiceStack 호스팅
코드가 나는 시도했다 :
public class WorkerRole : RoleEntryPoint
{
public class AppHost : AppHostHttpListenerBase
{
public AppHost()
: base("HttpListener Self-Host", typeof(HelloService).Assembly) { }
public override void Configure(Funq.Container container)
{
Routes
.Add<Hello>("/hello")
.Add<Hello>("/hello/{Name}");
}
}
public override void Run()
{
while (true)
{
Thread.Sleep(10000);
Trace.TraceInformation("Working", "Information");
}
}
public override bool OnStart()
{
// Set the maximum number of concurrent connections
ServicePointManager.DefaultConnectionLimit = 12;
// For information on handling configuration changes
// see the MSDN topic at http://go.microsoft.com/fwlink/?LinkId=166357.
try
{
var endpoint = RoleEnvironment.CurrentRoleInstance.InstanceEndpoints["Endpoint1"];
string baseUri = string.Format("{0}://{1}/", endpoint.Protocol, endpoint.IPEndpoint);
var appHost = new AppHost();
appHost.Init();
appHost.Start(baseUri);
}
catch (Exception e)
{
Trace.TraceError("Could not start service host. {0}", e.Message);
}
return base.OnStart();
}
}
서비스가 성공적으로 배포하지만 서비스에 액세스 할 수 없습니다입니다.
그럼 예외는 무엇입니까? – Scott
[이 비디오] (http://channel9.msdn.com/Series/Windows-Azure-Cloud-Services-Tutorials/Introduction-to-Windows-Azure-Worker-Roles-Part-1)를 시청할 수도 있습니다. ServiceStack이 아니지만 프린 서펄은 동일합니다. 엔드 포인트 액세스를 올바르게 구성했는지 확인하십시오. – Scott
운영 로그를 확인 했습니까? 어떤 오류가 있습니까? – vainolo