2016-02-26 91 views
0

我對WCF服務工作正在使用的WSHttpBinding,當我讓使用我的客戶測試應用程序在某一個點一個電話,我得到了錯誤的遠程服務器返回了意外的響應:The remote server returned an error: (413) Request Entity Too Large.WCF服務「遠程服務器返回錯誤:(413)請求實體太大。」

從綁定配置我web.config中的服務是這樣:

 <wsHttpBinding> 
      <binding name="secureHttpBinding" maxReceivedMessageSize="2147483647" maxBufferPoolSize="2147483647"> 
       <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647"/> 
       <security mode="Transport"> 
        <transport clientCredentialType="Certificate" /> 
       </security> 
      </binding> 
     </wsHttpBinding> 

而在服務端端點:

 <endpoint address="" binding="wsHttpBinding" bindingConfiguration="secureHttpBinding" contract="WS_UCC_XML.IWS_UCC_XML" /> 

而在所述客戶端結合的配置:

 <wsHttpBinding> 
      <binding name="wsHttpBinding_IWS_UCC_XML_SSL" maxBufferPoolSize="2147483647" 
       maxReceivedMessageSize="2147483647" receiveTimeout="01:00:00" sendTimeout="01:00:00"> 
       <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxNameTableCharCount="2147483647" 
        maxArrayLength="2147483647" maxBytesPerRead="2147483647" /> 
       <security mode="Transport"> 
        <transport clientCredentialType="Certificate" /> 
       </security> 
      </binding> 
     </wsHttpBinding> 
+0

1)它可能是服務端的設置,而不是客戶端。 2)你的服務配置中是否有明確的端點定義?除非將配置定義到端點,否則不會使用配置中的綁定定義。請發佈**服務的**配置的完整''部分。 – Tim

+0

我將端點配置添加到問題中。 – Lance

+0

嘗試在system.webServer-> security-> reqestFiltering的元素上設置'maxAllowedContentLength'屬性的上限。定義的綁定看起來是正確的。 – Tim

回答

0

的MAXBUFFERSIZE =「2147483647」參數添加到客戶端和服務器綁定標籤的配置:

<binding name="secureHttpBinding" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" maxBufferPoolSize="2147483647"> 

也嘗試MaxItemsInObjectGraph - 以下內容添加到服務器上的「system.serviceModel」節和客戶端:

<commonBehaviors> 
    <endpointBehaviors> 
    <dataContractSerializer maxItemsInObjectGraph="2147483647" /> 
    </endpointBehaviors> 
    <serviceBehaviors> 
    <dataContractSerializer maxItemsInObjectGraph="2147483647" /> 
    </serviceBehaviors> 
</commonBehaviors> 
相關問題