开发者

WCF rest web service working on localhost but not on host

I made a simple WCF web-service inside an ASP.net website.

The web-service is hosted by IIS and works fine on localhost, ie when accessing for exemple to http://localhost/myservice.svc/HelloWorld I get the correct "Hello World" response as expected.

But accessing to it by my computer hostname ( http://mycomputer/myservice.svc/HelloWorld ) gets me an error 404 response. This is particularly confusing as the remaining of the site (mainly aspx pages) is accessible without any problem from both ways.

I suspect a configuration issue in IIS, but I have no real clue. Any help would be really appreciated.

My service endpoint is the following:

<endpoint address="" binding="webHttpBinding" contract="MyService.Service" />

The error stacktrace from the server is the following:

[EndpointNotFoundException]: There was no channel actively listening at 'http://mycomputer.ad-ent.lan.net/myservice.svc/HelloWorld'. This is often caused by an incorrect address URI. Ensure that the address to which the message is sent matches an address on which a service is listening.
à System.ServiceModel.Activation.HostedHttpTransportManager.HttpContextReceived(HostedHttpRequestAsyncResult result)
   à System.ServiceModel.Activation.HostedHttpRequestAsyncResult.HandleRequest()
   à System.ServiceModel.Activation.HostedHttpRequestAsyncResult.BeginRequest()
[HttpException]: There was no channel actively listening at 'http://mycomputer.ad-ent.lan.net/myservice.svc/HelloWorld'. This is often caused by an incorrect address URI. Ensure that the address to which the message is sent matches an address on which a service is listening.
   à System.ServiceModel.AsyncResult.End[TAsyncResult](IAsyncResult result)
   à System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult result)
   à System.ServiceModel.Activation.HostedHttpRequestAsyncResult.ExecuteSynchronous(HttpApplication context, Boolean flowContext)
   à System.ServiceModel.Activation.HttpHandler.ProcessRequest(HttpContext context)
   à System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IE开发者_Go百科xecutionStep.Execute()
   à System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)


I found this over on server fault. https://serverfault.com/questions/107592/localhost-works-but-computer-name-does-not


Please check the NATs and firewall settings with your server, check out the following article

Working with NATs and Firewalls


Very old post, I know. But for the sake of history and knowledge; Chances are you are using a proxy, in this case, you need to add exception for your computer name in the your browser settings.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜