發送較大的物體到WCF結果我有一個單元測試,發送一箇中等大的對象到WCF服務。如果我爲該參數傳遞null,一切正常。當我發送一個填充對象時,我得到一個HTTP 400響應。在400錯誤的請求
WCF跟蹤顯示了這個錯誤:
The maximum message size quota for incoming messages (65536) has been exceeded.
不過,我已經拍成中的app.config爲單元測試項目大小配置參數如下:
<basicHttpBinding>
<binding name="BasicHttpBinding_IMyAppService" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="200000000" maxBufferPoolSize="200000000" maxReceivedMessageSize="200000000"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxArrayLength="200000000" maxStringContentLength="200000000"/>
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
我在想什麼在我的配置中,將允許的消息大小提高到錯誤消息中看到的65536以上?
UPDATE:
Web服務主機的web.config文件中還設置了maxReceivedMessageSize到一個較大的值(我認爲):
<binding name="basicHttpBindingConfig" maxReceivedMessageSize="20000000" maxBufferSize="20000000" maxBufferPoolSize="20000000">
<readerQuotas maxDepth="32" maxArrayLength="200000000" maxStringContentLength="200000000"/>
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Ntlm"/>
</security>
</binding>
對不起,我離開的那部分我原來的問題我還設置了maxReceivedMessageSize在Web服務的web.config,問題與特定的配置更新。你看到你在哪裏承載Web服務?如果在Windows服務託管,檢查應用程序的名字呢? –
問題。 exe.config(其中,appname是您的應用程序名稱)的配置設置。配置文件通常會自動時重新編譯更新。 – KrishHari
現在,它在2010年VS一個網站項目託管有一個web.config爲該項目(相關部分現在發佈在問題中) –