我的 WCF 服务有一个 OperationContract,它接受一个对象数组作为参数。这可能非常大。在寻找 Bad Request: 400 的修复后,我找到了真正的原因:最大消息大小。
我知道这个问题以前在很多地方都被问过。我已经尝试过大家所说的:“增加客户端和服务器配置文件的大小。” 我有。它仍然不起作用。
我的服务的 web.config:
<system.serviceModel>
<services>
<service name="myService">
<endpoint name="myEndpoint" address=""
binding="basicHttpBinding"
bindingConfiguration="myBinding"
contract="Meisel.WCF.PDFDocs.IPDFDocsService" />
</service>
</services>
<bindings>
<basicHttpBinding>
<binding name="myBinding"
closeTimeout="00:11:00"
openTimeout="00:11:00"
receiveTimeout="00:15:00"
sendTimeout="00:15:00"
maxBufferSize="2147483647"
maxReceivedMessageSize="2147483647"
maxBufferPoolSize="2147483647"
transferMode="Buffered"
allowCookies="false"
bypassProxyOnLocal="false"
hostNameComparisonMode="StrongWildcard"
messageEncoding="Text"
textEncoding="utf-8"
useDefaultWebProxy="true">
<readerQuotas maxDepth="2147483647"
maxStringContentLength="2147483647"
maxArrayLength="2147483647"
maxBytesPerRead="2147483647"
maxNameTableCharCount="2147483647" />
<security mode="None" />
</binding>
</basicHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
<dataContractSerializer maxItemsInObjectGraph="2147483647" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
我的客户的 app.config:
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IPDFDocsService"
closeTimeout="00:11:00"
openTimeout="00:11:00"
receiveTimeout="00:10:00"
sendTimeout="00:11:00"
allowCookies="false"
bypassProxyOnLocal="false"
hostNameComparisonMode="StrongWildcard"
maxBufferSize="2147483647"
maxBufferPoolSize="2147483647"
maxReceivedMessageSize="2147483647"
messageEncoding="Text"
textEncoding="utf-8"
transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="32"
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:8451/PDFDocsService.svc"
behaviorConfiguration="MoreItemsInObjectGraph"
binding="basicHttpBinding"
bindingConfiguration="BasicHttpBinding_IPDFDocsService"
contract="PDFDocsService.IPDFDocsService"
name="BasicHttpBinding_IPDFDocsService" />
</client>
<behaviors>
<endpointBehaviors>
<behavior name="MoreItemsInObjectGraph">
<dataContractSerializer maxItemsInObjectGraph="2147483647" />
</behavior>
</endpointBehaviors>
</behaviors>
</system.serviceModel>
我可能会错过什么或做错什么?就好像服务忽略了我在 maxReceivedBufferSize 中输入的内容。
在此先感谢,凯尔
更新
以下是另外两个从未收到答案的 StackOverflow 问题: