我有一个本地托管的 WCF 服务。我的 web.config 看起来像这样:
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_INavigationService" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="6553600" maxBufferPoolSize="5242880" maxReceivedMessageSize="6553600"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost/WebServices/NavigationService.svc/"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_INavigationService"
contract="NavigationService.INavigationService" name="BasicHttpBinding_INavigationService" />
</client>
</system.serviceModel>
如果我传入少于 8K 的文本,我的服务就可以正常工作。还有更多,我收到以下错误:
Sys.WebForms.PageRequestManagerServerErrorException: The formatter threw an exception while trying to deserialize the message: Error in deserializing body of request message for operation 'UpdateSiteMap'. The maximum string content length quota (8192) has been exceeded while reading XML data. This quota may be increased by changing the MaxStringContentLength property on the XmlDictionaryReaderQuotas object used when creating the XML reader. Line 75, position 166
有人能告诉我如何增加文本配额吗?如您所见,我将其设置为最大整数大小。
编辑
根据 Tim 的建议,这是我的新 Web.Config 文件:
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="6553600" maxBufferPoolSize="5242880" maxReceivedMessageSize="6553600"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost/WebServices/NavigationService.svc/"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_INavigationService"
contract="NavigationService.INavigationService" name="BasicHttpBinding_INavigationService" />
</client>
<services>
<service name="Navigation.INavigationService">
<endpoint address=""
binding="basicHttpBinding"
bindingConfiguration="BasicHttpBinding_INavigationService"
contract="NavigationService.INavigationService" />
</service>
</services>