2011-03-29 93 views
2

我在ASP.net网站内做了一个简单的WCF网络服务。WCF休息Web服务工作本地主机,但不是在主机

的网络服务是由托管IIS和访问用于为例来 http://localhost/myservice.svc/HelloWorld我得到正确的“Hello World”的响应按预期在本地主机上正常工作,即。

但通过我的电脑主机名(http://mycomputer/myservice.svc/HelloWorld)访问它给我一个错误的404响应。这尤其令人困惑,因为网站的其余部分(主要是aspx页面)可以从两个方面访问而不会有任何问题。

我怀疑在IIS中的配置问题,但我没有真正的线索。任何帮助将非常感激。

我的服务端点如下:

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

来自服务器的错误堆栈跟踪如下:

[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.IExecutionStep.Execute() 
    à System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) 
+0

什么在你的web.config - 元素?我看不到MSDN中那些仅限于本地主机的人,但我不是这里的专家,我想这就是问题所在。 – Rup 2011-03-29 13:23:56

+0

您运行的是哪个版本的IIS? – 2011-03-29 13:25:33

+0

右键单击iis admin中的svc文件并选择“浏览”会发生什么? – 2011-03-29 13:40:45

回答

0

请检查NAT和防火墙设置您的服务器,请查看以下文章

Working with NATs and Firewalls

+0

我的服务器位于我的电脑本身,并且相应的端口(80)全部打开,如网站其他部分所示。问题在于别处。 – Falanwe 2011-03-29 13:06:41

+0

非常正确。我投票删除 – 2011-03-29 13:50:52

0

很老的帖子,我知道。但是为了历史和知识;有可能您正在使用代理,在这种情况下,您需要在浏览器设置中为您的计算机名称添加例外。

相关问题