Connecti WCF通过IP地址提供服务 [英] Connecti WCF service through IP address
本文介绍了Connecti WCF通过IP地址提供服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在我的一个WCF应用程序项目中,我可以通过浏览器查看服务页面,例如 http:// localhost:19648 / Service1.svc 。在这种情况下,在web.config中。
< baseAddresses >
< add baseAddress = http:// localhost:19648 / Service1 / >
< / baseAddresses >
但是,如果我将localhost更改为我的CPU的IP,就像那样http://10.10.22.168:19648/Service1 ,无法加载页面:连接已超时。在web.config中的这种情况下,
< baseAddresses >
< 添加 baseAddress = http://10.10.22.168:19648/Service1 / >
< / baseAddresses >
如何解决此问题?谢谢。
解决方案
正如Mehdi在评论中所提到的,请检查防火墙设置。
看看下面的链接。
http://social.msdn.microsoft.com/Forums/vstudio/en -US / 7d7aefe5-0dd6-4105-bc4b-107a1a70fe77 / access-wcf-service-with-ip-address?forum = wcf
你可以还可以尝试在web.config的serviceBehaviors
中使用useRequestHeadersForMetadataAddress
。
看看下面的链接吧。
http://stackoverflow.com/questions/18202255/cannot-access-wcf-service-remotely
In one of my WCF application project, I can view the service page through browser, e.g. http://localhost:19648/Service1.svc. In this scenario, in web.config.
<baseAddresses>
<add baseAddress="http://localhost:19648/Service1" />
</baseAddresses>
However, if I change localhost to my CPU's IP, like that http://10.10.22.168:19648/Service1, the page can't be loaded: The connection has timed out. In this scenario in the web.config,
<baseAddresses>
<add baseAddress="http://10.10.22.168:19648/Service1" />
</baseAddresses>
How can this problem be fixed? Thanks.
解决方案
As mentioned by Mehdi in comments, check your Firewall settings.
Have a look at below link.
http://social.msdn.microsoft.com/Forums/vstudio/en-US/7d7aefe5-0dd6-4105-bc4b-107a1a70fe77/access-wcf-service-with-ip-address?forum=wcf
You may also try by usinguseRequestHeadersForMetadataAddress
in theserviceBehaviors
of your web.config.
Have a look ate below link.
http://stackoverflow.com/questions/18202255/cannot-access-wcf-service-remotely
这篇关于Connecti WCF通过IP地址提供服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文