【发布时间】:2014-11-21 17:33:46
【问题描述】:
我的 WCF 服务抛出 ProtocolException (403) - 请求实体太大。将文件 (~100KiB) 推送到服务时会发生这种情况。
奇怪的是,这只发生在托管(暂存)版本上,而不是本地。我的客户端配置是:
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="DefaultBindingConfiguration" closeTimeout="01:00:00" openTimeout="01:00:00" receiveTimeout="01:00:00" sendTimeout="01:00:00" maxBufferSize="1000000000" maxBufferPoolSize="1000000000" maxReceivedMessageSize="1000000000">
<readerQuotas maxDepth="1000000000" maxStringContentLength="1000000000" maxArrayLength="64000000" maxBytesPerRead="1000000000" maxNameTableCharCount="1000000000" />
<security mode="None" />
</binding>
</basicHttpBinding>
</bindings>
...
</system.serviceModel>
我的服务器配置是:
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding maxBufferSize="1000000000" maxReceivedMessageSize="1000000000" maxBufferPoolSize="1000000000" sendTimeout="01:00:00" receiveTimeout="01:00:00">
<readerQuotas maxDepth="1000000000" maxStringContentLength="1000000000" maxArrayLength="1000000000" maxBytesPerRead="1000000000" />
<security mode="None"/>
</binding>
</basicHttpBinding>
</bindings>
...
</system.serviceModel>
为简洁起见,我省略了<behaviours> 部分。客户端以编程方式创建端点,全部使用DefaultBindingConfiguration。我可以通过选择性地将值减小到1 来确认服务器和客户端绑定配置正在本地生效,然后看到它失败了。
任何想法为什么托管服务器的行为可能与我的本地服务器不同?显着差异:
- 本地操作系统:Windows 7,主机操作系统:Windows Server 2012
- 本地 IIS:7,主机 IIS 8(.5?)
注意:为了先发制人“那些值太高”和“不要设置全局值”,我知道风险所以不要'不需要提醒。 :)
非常感谢任何指针和建议。
更新:
此问题已自行解决。重新启动网络场中的节点后,不再显示此行为。这并没有让我充满信心,因为如果它再次发生,我不知道如何解决它。我欢迎提供可以说明为什么会出现这种情况的答案...
【问题讨论】:
-
这个老问题可能会提供一些提示:stackoverflow.com/questions/10122957/…
标签: .net wcf wcf-binding throttling basichttpbinding