讀我有一個WCF服務下面的服務器端的app.config:WCF maxReceivedMessageSize不是從配置
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="default" maxReceivedMessageSize="5000000">
<readerQuotas maxStringContentLength="5000000" maxArrayLength="5000000" />
</binding>
</wsHttpBinding>
</bindings>
<services>
<service behaviorConfiguration="Core.TOAService.Service1Behavior"
name="Core.TOAService.TOAService">
<endpoint address="" binding="wsHttpBinding" contract="Core.TOAService.ITOAService">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:8732/Design_Time_Addresses/Core.TOAService/TOAService/" />
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="Core.TOAService.Service1Behavior">
<!-- To avoid disclosing metadata information,
set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="True"/>
<!-- To receive exception details in faults for debugging purposes,
set the value below to true. Set to false before deployment
to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
當我試圖通過這個服務一個相當大的文件(僅〜250KB),我得到記錄在文件svclog一個例外:
的最大消息大小配額 傳入消息(65536)一直 超出。要增加配額,請使用 MaxReceivedMessageSize屬性 上適當的綁定元素。
正如你可以在配置的頂部的結合部看,我已經嘗試了maxReceivedMessageSize設置〜5000000,但該服務仍然認爲它設置爲默認的65536任何想法,什麼是錯的或者哪個是「合適的」綁定元素?
是的,你必須引用綁定配置。 緩衝區更改可能不是必需的。 – 2009-08-27 20:50:43
從未很清楚是否真的需要三種緩衝區更改中的哪一種 - 它有助於嘗試並查看。關於如何調整這些設置,真的沒有好的,全面的文檔和解釋,不幸的是...... – 2009-08-27 20:51:52
Doh,爲我使用VS2010構建3.5服務提供了服務!非常感謝,這是固定的。 – 2009-08-27 21:01:45