我遇到了WCF服务调用的问题。该服务采用一个复杂的对象,其中包含许多对象列表。当对象太大时会发生此问题。我收到一个未找到的通信异常。只要项目不是太大,呼叫就会起作用。任何帮助,将不胜感激。以下是客户端配置文件的相关部分:
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_ICartService" maxBufferSize="2147483647"
maxReceivedMessageSize="2147483647">
<security mode="None" />
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="../Services/CartService.svc"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_ICartService"
contract="AccessPoint.RichClient.Wcf.ICartService"
name="BasicHttpBinding_ICartService" />
</client>
web.config文件包含以下内容:
<bindings>
<basicHttpBinding>
<binding name="basicHttpLargeMessage" closeTimeout="00:02:00"
openTimeout="00:02:00" receiveTimeout="00:10:00" sendTimeout="00:02:00"
maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
maxArrayLength="2147483647" maxBytesPerRead="2147483647"
maxNameTableCharCount="2147483647" />
</binding>
</basicHttpBinding>
</bindings>
<services>
<service behaviorConfiguration="CartService.CartServiceBehavior"
name="AccessPoint.WcfServices.CartService">
<endpoint address="" behaviorConfiguration="CartServiceBehavior"
binding="basicHttpBinding" bindingConfiguration="basicHttpLargeMessage"
contract="AccessPoint.WcfServices.ICartService" />
</service>
<behaviors>
<serviceBehaviors>
<behavior name="CartService.CartServiceBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
<dataContractSerializer maxItemsInObjectGraph ="2147483647"/>
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="CartServiceBehavior">
<dataContractSerializer maxItemsInObjectGraph="2147483647" />
</behavior>
</endpointBehaviors>
</behaviors>
答案 0 :(得分:0)
任何服务器错误都将在Silverlight中反映为“未找到”异常。您需要使用一些网络嗅探工具(例如Fiddler)来查看响应是否有关于错误的一些其他信息,或者在服务器端使用enable tracing来查看它为何返回不成功的响应。
http://blogs.msdn.com/b/silverlightws/archive/2010/09/23/debugging-wcf-services-in-silverlight.aspx上的帖子有一个视频,其中包含有关在Silverlight中调试WCF服务的大量信息。