轉自:http://karatejb.blogspot.tw/2015/04/troubleshooting-wcf-error-413-request.html
使用wcf服務時出現以下錯誤
(413) Request Entity Too Large
原來是WCF預設單筆Message size 為65KB, 避免DOS攻擊。
當超過此上限時,便會引發此錯誤。
這時候需再client端和wcf服務端的config加上以下設定
WCF的Config檔
<configuration>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding maxReceivedMessageSize="2147483647"
maxBufferSize="2147483647"
maxBufferPoolSize="2147483647">
<readerQuotas maxDepth="32"
maxArrayLength="2147483647"
maxStringContentLength="2147483647"/>
</binding>
</basicHttpBinding>
</bindings>
</system.serviceModel>
</configuration>
|
Client的Config檔
<configuration>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IMonitorService"
maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647"receiveTimeout="00:30:00" sendTimeout="00:30:00"/>
</basicHttpBinding>
<netNamedPipeBinding>
<binding name="NetNamedPipeBinding_IMonitorService">
<security mode="None" />
</binding>
</netNamedPipeBinding>
</bindings>
</system.serviceModel>
</configuration>
|
0 意見:
張貼留言