本文介绍了无法从Internet访问WCF服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 我有运行我的本地IIS的WCF服务 [ ^ ] 当我访问本地时,每件事情都没问题,但当我尝试访问时通过互联网使用公共IP映射到我的本地IP和发布, 我在客户端添加Wcf服务后我打电话 我有这个错误: 没有端点监听http: // abdirizak-pc:90 /HelloService.svc/HelloService可以接受该消息。这通常是由错误的地址或SOAP操作引起的。见InnerException, 感谢你的帮助... 我的尝试: 我的配置文件: <? xml 版本 = 1.0 ? > < configuration > < system.serviceModel > < 行为 > < serviceBehaviors > < 行为 名称 = mexbehavior > < serviceMetadata httpGetEnabled = true / > < /行为 > < / serviceBehaviors > < / behavior > < services > < service behaviorConfiguration = mexbehavior 名称 = HelloService.HelloService > < endpoint 地址 = HelloService binding = basicHttpBinding 合同 = HelloService.IHelloService / > < endpoint 地址 = mex binding = mexHttpBinding contract = IMetadataExchange / > < host > < baseAddresses > < add baseAddress = http:// localhost:90 / > < / baseAddresses > < / host > < / service > < / services > < / system.serviceModel > < system.web > < 编译 debug = true targetFramework = 4.5.2 / > < httpRuntime targetFramework = 4.5.2 / > < / system.web > < / configuration > ; 解决方案 这是因为您使用的是 localhost 。您必须使用托管服务的计算机的IP地址。 因为在基地址您已经提供了本地主机的地址,您必须在此处提供您的公共IP地址或网址你的服务器。如果它也不起作用,你就添加了多个端点。 < 端点 名称 = basicHttpEndpoint 地址 = bi nding = basicHttpBinding bindingConfiguration = basicHttpBindingConfig 合同 = IService1 / > < endpoint name = webHttpEndpoint address = / support binding = webHttpBinding bindingConfiguration = webHttpBindingConfig 合同 = IService1 behaviorConfiguration = jsonBehaviour / > < endpoint name = mexHttpEndpoint 地址 = / mex binding = mexHttpBinding 合同 = IMetadataExchange / > I have WCF Service Running My Local IIS[^]When i Access Local every thing is Ok, but when i try to access Over Internet Using Public IP that Mapping to my Local IP and Post,after I add Wcf Service in Client and i CallI Got This Error:There was no endpoint listening at http://abdirizak-pc:90/HelloService.svc/HelloService that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException,thanks for U Help...What I have tried:My Config File :<?xml version="1.0"?><configuration> <system.serviceModel> <behaviors> <serviceBehaviors> <behavior name="mexbehavior"> <serviceMetadata httpGetEnabled="true"/> </behavior> </serviceBehaviors> </behaviors> <services> <service behaviorConfiguration="mexbehavior" name="HelloService.HelloService"> <endpoint address="HelloService" binding="basicHttpBinding" contract="HelloService.IHelloService"/> <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /> <host> <baseAddresses> <add baseAddress="http://localhost:90"/> </baseAddresses> </host> </service> </services> </system.serviceModel> <system.web> <compilation debug="true" targetFramework="4.5.2" /> <httpRuntime targetFramework="4.5.2" /> </system.web></configuration> 解决方案 It's because you're using localhost. You have to use the IP address of the machine where the service is hosted.Because at base address you have give the address of local host you have to give your public i.p address here or url of your server. And if its also not working the you have add multiple endpoints.<endpoint name="basicHttpEndpoint" address="" binding="basicHttpBinding" bindingConfiguration="basicHttpBindingConfig" contract="IService1" /> <endpoint name="webHttpEndpoint" address="/support" binding="webHttpBinding" bindingConfiguration="webHttpBindingConfig" contract="IService1" behaviorConfiguration="jsonBehaviour" /> <endpoint name="mexHttpEndpoint" address="/mex" binding="mexHttpBinding" contract="IMetadataExchange" /> 这篇关于无法从Internet访问WCF服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
09-13 11:19