SilverLight调用WCF”远程服务器返回了错误: NotFound”的排解

来源:互联网 发布:动漫软件下载排行榜 编辑:程序博客网 时间:2024/05/08 08:08

远程服务器返回了错误: NotFound,该错误一般为WCF调用不成功,SL的错误类型是CommunicationException,但是具体的错误类型及信息不完整,通过以下方法,可以使错误信息更加完成。

 

在WCF服务的类中加上

[ServiceBehavior(IncludeExceptionDetailInFaults = true)]

 

然后在调用此服务的silverlight的初始化方法中加上: 

bool registerResult = WebRequest.RegisterPrefix("http://", WebRequestCreator.ClientHttp);
bool httpsResult = WebRequest.RegisterPrefix("https://", WebRequestCreator.ClientHttp);

 

原创粉丝点击