简体   繁体   English

如何处理服务参考错误?

[英]How to Handle Service Reference Errors?

I have a WCF service hosted on a server, but whenever internet connection fails i'm getting error System.ServiceModel.CommunicationException . 我在服务器上托管了WCF服务,但是每当互联网连接失败时,我都会收到错误System.ServiceModel.CommunicationException Even though I tried to handle that in completed method, error pops up in Reference Page Method. 即使我尝试使用完成的方法来解决该问题,在“参考页方法”中也会弹出错误。

Erros is because of Server is not found..! Erros是因为找不到服务器。 But there should be a way to handle this..! 但是应该有一种方法可以解决这个问题。

How do I restrict and handle this error? 如何限制和处理此错误? Otherwise I have to remove Services..! 否则,我必须删除服务..! Is There any Other way to do or handle this? 还有其他方法可以执行或处理吗?

使用try and catch编辑了reference.cs页面,以获取服务的接收方法。

您可以通过放置适当的异常处理和Exception类来解决此问题

I guess you tried to connect the Windows phone 8 emulator to the localhost WCF service? 我猜您尝试将Windows Phone 8仿真器连接到localhost WCF服务吗?

This won't work because the emulator is in a virtual machine but there are steps to fix it: 由于仿真器位于虚拟机中,因此无法正常工作,但是有一些步骤可以解决:

Take a look at this 看看这个

For more 欲了解更多

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM