wcf配置maxStringContentLength似乎不起作用
我们正在尝试将大型xml字符串发送到WCF中的服务方法,我们收到错误
最大字符串内容长度
超过了配额(8192)
读取XML数据。
错误建议增加
maxstringcontentlength
虽然我们不确定我们是否应该在客户端或服务器端或两者都这样做。我们已经尝试过投入两者,但我们似乎仍然得到错误。我将在下面发布客户端和服务配置。我假设其中一个或两个都存在问题,导致无法正常工作。
有什么建议?
客户:
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_ITESTService"
closeTimeout="00:01:00" openTimeout="00:01:00"
receiveTimeout="00:10:00" sendTimeout="00:01:00"
allowCookies="false" bypassProxyOnLocal="false"
hostNameComparisonMode="StrongWildcard"
maxBufferSize="65536" maxBufferPoolSize="524288"
maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8"
transferMode="Buffered" useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="2147483647"
maxArrayLength="2147483647" maxBytesPerRead="4096"
maxNameTableCharCount="2147483647" />
<security mode="None" />
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint name="BasicHttpBinding_ITESTService"
address="http://localhost/TESTService.svc"
binding="basicHttpBinding"
bindingConfiguration="BasicHttpBinding_ITESTService"
contract="TESTService.ITESTService" />
</client>
</system.serviceModel>
服务器:
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding
name="BasicHttpBinding_Service1"
maxBufferSize="2147483647"
maxReceivedMessageSize="2147483647">
<readerQuotas maxDepth="32"
maxStringContentLength="2147483647" maxArrayLength="2147483647"
maxBytesPerRead="4096" maxNameTableCharCount="2147483647" />
<security mode="None" />
</binding>
</basicHttpBinding>
</bindings>
<services>
<service name="TESTService">
<endpoint name="BasicHttpBinding_Service1"
address="http://localhost/TESTService.svc"
binding="basicHttpBinding"
bindingConfiguration="BasicHttpBinding_Service1"
contract="ITESTService" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
没有找到相关结果
已邀请:
4 个回复
扦帽次杏
嘘伪
设置。 这对我有用(虽然我不确定为什么WCF会忽略正确命名绑定的
)
诧不达
可扇胆