我的WCF服務有一個OperationContract,它接受一個對象數組作爲參數。這可能會相當大。在查找Bad Request:400的修復程序後,我找到了真正的原因:最大的消息大小。傳入郵件的最大郵件大小限額(65536)已被超出
我知道這個問題已經在很多地方被問過。我試過每個人都說:「增加客戶端和服務器配置文件的大小。」我有。它仍然不起作用。
我服務的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中輸入的內容。
由於提前, 凱爾
UPDATE
這裏是他們從來沒有收到答覆其他兩個StackOverflow的問題,無論是:
WCF MaxReceivedMessageSize property not taking
它看起來正確一目瞭然。你是否在代碼中配置了終點?如果是這樣,那可能會覆蓋配置設置。 – 2010-05-25 22:07:42
你是如何託管這項服務的? IIS? – 2010-05-25 23:58:27
@Jeff:我剛剛創建了一個新的服務客戶端實例,然後調用OperationContract,傳入我的自定義類作爲參數。沒有什麼花哨。 @Simon:我正在使用ASP .NET開發服務器。目前,它都是本地的。 – DaleyKD 2010-05-26 00:45:58