我做簡單的WCF服務在IIS上 客戶的WinForms運行 服務器端。WCF MaxStringContentLength錯誤
當我試圖大串發送到服務器,我異常有如下:
格式化拋出一個異常,而試圖反序列化 消息:錯誤操作 「CreateFolder」反序列化請求消息的身體。在讀取XML數據時,超過了最大字符串內容長度配額(8192) 。此配額可以增加 改變在 XmlDictionaryReaderQuotas的MaxStringContentLength屬性創建XML讀取器時對象使用。 147 線,位置78
客戶端的app.config:
<configuration>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IService1" maxReceivedMessageSize="10000000" >
<readerQuotas maxDepth="32" maxStringContentLength="10000000" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://192.168.15.72:7777/Service1.svc" binding="basicHttpBinding"
bindingConfiguration="BasicHttpBinding_IService1" contract="ServiceReference1.IService1"
name="BasicHttpBinding_IService1" />
</client>
</system.serviceModel>
</configuration>
服務器Web配置:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IService1" maxReceivedMessageSize="10000000"
maxBufferSize="10000000" >
<readerQuotas maxDepth="32" maxStringContentLength="10000000" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
</binding>
</basicHttpBinding>
</bindings>
<services>
<service name="WCFService">
<endpoint address="" binding="basicHttpBinding"
bindingConfiguration="BasicHttpBinding_IService1" contract="ServiceReference1.IService1"
name="BasicHttpBinding_IService1">
</endpoint>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<appSettings>
<add key="PathToSafe" value="D:\Temp"/>
</appSettings>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>
當我在本地主機上運行的服務器IIS它的偉大工程。 任何想法如何解決這個問題?
重複的可能看到這個鏈接在這裏,http://stackoverflow.com/questions/6600057/the-maximum-string-content-更新服務器端配置長度配額8192 - 過氣 - 超過-而讀-X – Bearcat9425
請注意,如果你沒有指定該綁定定義端點(通過'endpoint'元素的'bindingConfiguration'屬性)的變化贏得不會生效。將使用端點指定綁定的默認值。 – Tim