Calling a WCF service from a Window 8 Metro application – cross machine scenario

本文探讨了在Windows Communication Foundation (WCF)服务被Metro客户端应用调用时遇到的问题,特别是在不同机器间进行跨域调用时。文章详细介绍了如何通过添加“家庭/工作网络”权限来解决跨域连接失败的问题。

So you have developed your WCF service to be consumed by your Metro client application – you would likely have done the development on your local machine. What is the next step [before we move to Azure Smile ? You will probably take your service and deploy it on another machine either for testing cross machine scenario or you are just going with on-premise hosting.

So what is interesting here? Well, start up the metro client and try to connect to the WCF service. Does it work? 

If you are calling the service asynchronously which is how you should be doing it – you will see the metro client just hang waiting for the service to respond. While calling synchronously you will see an Aggregate exception throw almost instantly with the inner exception being – “There was no endpoint listening at /.svc">/.svc">http://<serverName>/<service>.svc that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.".  with innermost exception of – “{"An attempt was made to access a socket in a way forbidden by its access permissions XXX.XXX.XXX.XXX:80"}”

To fix this - what you need to do is to add an additional capability to your metro application – “Home/Work networking” – this enables metro applications access services in your domain network. More information here.

 

 

 

转载于:https://www.cnblogs.com/51dotnet/archive/2012/11/30/2796334.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值