2013-05-31 14 views
0

我知道很多人已經發布了關於此的解決方案,我嘗試了所有發佈在互聯網,但那些不適合我。在這種情況下,我想從SharePoint計時器作業中消耗WCF服務。WCF:InnerException消息是'在一個對象圖中可以>序列化或反序列化的項目的最大數量是'65536'

我經常收到的問題如下所述:

格式化拋出一個異常,而試圖反序列化 消息:嘗試反序列化參數 http://test/MyEntry/2010/03:GetResult時出錯。 InnerException消息 是'在 中可以序列化或反序列化的項目的最大數目,對象圖是'65536'。更改對象圖或增加MaxItemsInObjectGraph配額。 」。請參閱InnerException獲取更多 的詳細信息。

我的服務器端的web.config的SVC是:

<system.serviceModel> 
     <bindings> 
      <wsHttpBinding> 
     <binding name="WSHttpBinding_IVerksamhetService_server" closeTimeout="10:10:00" 
      openTimeout="10:10:00" receiveTimeout="10:10:00" sendTimeout="10:10:00" 
      bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard" 
      maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" 
      messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" 
      allowCookies="false" > 
       <readerQuotas maxDepth="64" maxStringContentLength="2147483647" maxArrayLength="2147483647" 
       maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />     
     </binding> 
     </wsHttpBinding> 
    </bindings> 
     <services> 
     <service behaviorConfiguration="SomeService.DeluxeEntryBehavior" name="SomeService.DeluxeEntry"> 
      <endpoint address="" binding="wsHttpBinding" contract="SomeService.IVerksamhetService" bindingConfiguration="WSHttpBinding_IVerksamhetService_server" > 
      <identity> 
       <dns value="localhost"/> 
      </identity> 
      </endpoint> 
      <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/> 
     </service> 
     </services> 
     <behaviors> 
      <serviceBehaviors> 
       <behavior name="SomeService.DeluxeEntryBehavior"> 
         <serviceMetadata httpGetEnabled="true" /> 
         <serviceDebug includeExceptionDetailInFaults="true" />   
         <dataContractSerializer maxItemsInObjectGraph="2147483647" /> 
       </behavior> 
      </serviceBehaviors> 
     </behaviors> 
    </system.serviceModel> 

我的客戶端配置(我加在OWSTIMER.EXE.CONFIG文件此配置)

<system.serviceModel> 
     <bindings> 
      <wsHttpBinding> 
       <binding name="WSHttpBinding_IVerksamhetService" closeTimeout="00:01:00" 
        openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" 
        bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard" 
        maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" 
        messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" 
        allowCookies="false"> 
        <readerQuotas maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxDepth="64" maxNameTableCharCount="2147483647" />     
       </binding> 
      </wsHttpBinding> 
     </bindings> 
     <behaviors> 
      <endpointBehaviors> 
      <behavior name="ServiceViewEventBehavior"> 
       <dataContractSerializer maxItemsInObjectGraph="2147483647"/>  
      </behavior> 
      </endpointBehaviors> 
     </behaviors> 
     <client> 
      <endpoint address="http://testserver.ivodmz.za/TestService/MyWCF.svc" 
       binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IVerksamhetService" 
       contract="IVerksamhetService" behaviorConfiguration= "ServiceViewEventBehavior" name="WSHttpBinding_IVerksamhetService"> 
       <identity> 
        <dns value="localhost" /> 
       </identity> 
      </endpoint> 
     </client>  
    </system.serviceModel> 

更新:

我有WCF端點設置限制爲65536,但是如何讓端點忽略dll行爲並使用XML配置中指定的內容?

回答

2

添加行爲congig和AAD它以服務

<serviceBehaviors> 
     <behavior name="DefaultBehavior" MaxItemsInObjectGraph="2147483647"> 
     <dataContractSerializer maxItemsInObjectGraph="2147483647" /> 
     <serviceMetadata httpGetEnabled="true" /> 
     <serviceDebug includeExceptionDetailInFaults="true" /> 
     </behavior> 
</serviceBehaviors> 
+0

它在客戶端和服務器已經添加,所以有什麼錯我的CONFIGS(在我的問題說)代碼 – Geek

+1

可能有人重寫的行爲嗎? –

+0

是的,代碼中存在覆蓋行爲。我該如何解決這個問題?請記住,我無法重新構建該dll。如何要求Web服務採用XML配置。 – Geek

相關問題