C# WCF服务需要多次尝试才能在Silverlight OOB应用程序中正常工作
我正试图通过Silverlight 4 OOB应用程序使用WCF服务。服务本身返回仅由原语(String、DateTime、int…)组成的类。我在IIS中作为web应用程序托管它 这些类及其属性都用[DataContract]和[DataMember]标记,我已经添加了正确的端点等。所以配置是可以的,至少看起来是这样 奇怪的是,我必须试着打好几次电话才能让服务正常工作。当通过单元测试从同一个项目调用它时,它总是从第一次开始工作 当我在Fiddler中查看响应时,我看到一个干净的反序列化XML,没有错误,所以这是可行的!答复的一部分:C# WCF服务需要多次尝试才能在Silverlight OOB应用程序中正常工作,c#,.net,silverlight,wcf,serialization,C#,.net,Silverlight,Wcf,Serialization,我正试图通过Silverlight 4 OOB应用程序使用WCF服务。服务本身返回仅由原语(String、DateTime、int…)组成的类。我在IIS中作为web应用程序托管它 这些类及其属性都用[DataContract]和[DataMember]标记,我已经添加了正确的端点等。所以配置是可以的,至少看起来是这样 奇怪的是,我必须试着打好几次电话才能让服务正常工作。当通过单元测试从同一个项目调用它时,它总是从第一次开始工作 当我在Fiddler中查看响应时,我看到一个干净的反序列化XML,
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Response xmlns="http://tempuri.org/">
<Number>82072826584</Number>
<Date>28/07/1982</Date>
<Sex>1</Sex>
</Response>
</s:Body>
</s:Envelope>
错误本身包含以下内容(代码片段):
{System.ServiceModel.CommunicationException: The remote server returned an error: NotFound.
---> System.Net.WebException: The remote server returned an error: NotFound.
---> System.Net.WebException: The remote server returned an error: NotFound.
at System.Net.Browser.BrowserHttpWebRequest.InternalEndGetResponse(IAsyncResult asyncResult)
{System.Net.WebException: The remote server returned an error: NotFound.
---> System.Net.WebException: The remote server returned an error: NotFound.
at System.Net.Browser.BrowserHttpWebRequest.InternalEndGetResponse(IAsyncResult asyncResult)
at System.Net.Browser.BrowserHttpWebRequest.<>c__DisplayClass5.<EndGetResponse>b__4(Object sendState)
{System.Net.WebException:远程服务器返回错误:NotFound。
--->System.Net.WebException:远程服务器返回错误:NotFound。
位于System.Net.Browser.BrowserHttpWebRequest.InternalEndGetResponse(IAsyncResult asyncResult)
在System.Net.Browser.BrowserHttpWebRequest.c__DisplayClass5.b__4(对象发送状态)中
我在WCF配置中启用了异常,但在实际的错误发回中没有任何区别。起初我认为可能由于非SL类,某些部分无法序列化,但当我继续尝试时,它最终会工作……对我来说没有任何意义
有什么想法吗?你能在服务端和客户端都发布web.config吗?好的,我想我解决了,但它回来了…请复制并粘贴配置文件到你的问题中。让我们看一看…谢谢-web.config:;客户端: