我遇到了WCF服務調用的問題。該服務需要一個複雜的對象,其中包含許多對象列表。當對象變得太大時會出現問題。我收到一個說Not Found的通信異常。只要該項目不太大,該調用就可以工作。任何幫助,將不勝感激。下面是客戶端配置文件中的相關部分:未找到大對象的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>
你可以添加確切的異常和堆棧跟蹤?多大? MB的? GB的? TB的? – rene
以下是來自外部異常的堆棧跟蹤:System.ServiceModel.AsyncResult.End [TAsyncResult](IAsyncResult result) at System.ServiceModel.Channels.ServiceChannel.SendAsyncResult.End(SendAsyncResult result) at System.ServiceModel.Channels .ServiceChannel.EndCall(String action,Object [] outs,IAsyncResult result) at System.ServiceModel.ClientBase'1.ChannelBase'1.EndInvoke(String methodName,Object [] args,IAsyncResult result) at AccessPoint.WcfServices.CartWcfS .CartWcfSClient.CartWcfSClientChannel.EndSaveCart(IAsyncResult result) – dna86
和內部異常的堆棧跟蹤:在System.Net.Browser.AsyncHelper.BeginOnUI(SendOrPostCallback beginMethod,Object state) at System.Net.Browser.BrowserHttpWebRequest.EndGetResponse(IAsyncResult asyncResult) at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelAsyncRequest.CompleteGetResponse(IAsyncResult result) – dna86