2013-05-08 61 views
2

我和我的同事們一直在試圖解決發送超過8192字節數據到Web Service的問題。我已經嘗試創建一個簡單的WCF項目來測試發送一些數據,但它仍然失敗在8192 +字節。我已經閱讀了數百個網頁,並對web.config文件進行了更改,以確保元素足夠大,但仍不起作用。無法增加最大字符串內容長度限額(8192)

任何建議,將不勝感激。

我們正在使用本地主機上的IIS Express作爲Web服務器並使用WCFTestClient向服務發送數據來測試該服務。我們也嘗試使用Storm作爲將數據發送到Web服務的客戶端。

<?xml version="1.0"?> 
<configuration> 

    <system.web> 
    <compilation debug="true" targetFramework="4.0" /> 
    </system.web> 
    <system.serviceModel> 
    <client> 
     <endpoint binding="basicHttpBinding" bindingConfiguration="NewBinding0" 
     contract="IService1" name="ClientEndPointName" /> 
    </client> 
    <services> 
     <service name="Service1"> 
     <endpoint address="http://localhost:2787" binding="basicHttpBinding" 
      bindingConfiguration="NewBinding0" name="DROServiceX" bindingName="DROBindingName" 
      contract="IService1" isSystemEndpoint="false" /> 
     </service> 
    </services> 
    <bindings> 
     <basicHttpBinding> 
     <binding name="NewBinding0" transferMode="Buffered"> 
      <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" 
     maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" /> 
     </binding> 
     </basicHttpBinding> 
    </bindings> 
    <behaviors> 
     <serviceBehaviors> 
     <behavior> 
      <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment --> 
      <serviceMetadata httpGetEnabled="true"/> 
     <!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information --> 
      <serviceDebug includeExceptionDetailInFaults="false"/> 
     </behavior> 
     </serviceBehaviors> 
    </behaviors> 
    <serviceHostingEnvironment aspNetCompatibilityEnabled="false" 
    multipleSiteBindingsEnabled="true" /> 
    </system.serviceModel> 
<system.webServer> 
    <modules runAllManagedModulesForAllRequests="true"/> 
    </system.webServer> 

</configuration> 
+0

客戶端也有各種超時和限制。你配置了那些? – 2013-05-08 10:10:48

+0

這其他[SO線程](http://stackoverflow.com/questions/8225736/transfer-large-amount-of-data-in-wcf-service)可能會有所幫助。 – 2013-05-08 10:23:30

回答

0

您應該在服務器和客戶端上進行配置。如果其中一個未正確配置,請求將失敗。您的服務器配置正確,因此您應該查看客戶端配置。如果您真的知道發生了什麼,請啓動WCF跟蹤以查看會發生什麼。

WCF Tracing MSDN

相關問題