.net WCF默认绑定配置设置在主机上不生效
我的WCF服务正在抛出ProtocolException(403)-请求实体太大。将文件(~100KiB)推送到服务时会发生这种情况 奇怪的是,这只发生在托管(暂存)版本上,而不是本地。我的客户端配置是:.net WCF默认绑定配置设置在主机上不生效,.net,wcf,wcf-binding,throttling,basichttpbinding,.net,Wcf,Wcf Binding,Throttling,Basichttpbinding,我的WCF服务正在抛出ProtocolException(403)-请求实体太大。将文件(~100KiB)推送到服务时会发生这种情况 奇怪的是,这只发生在托管(暂存)版本上,而不是本地。我的客户端配置是: <system.serviceModel> <bindings> <basicHttpBinding> <binding name="DefaultBindingConfiguration" closeT
<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>
...
我的服务器配置是:
<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>
...
为了简洁起见,我省略了
部分。客户端以编程方式创建端点,所有这些都使用DefaultBindingConfiguration
。我可以通过有选择地将值减少到1
来确认服务器和客户端绑定配置在本地生效,并看到它失败
你知道为什么托管服务器的行为可能与我的本地服务器不同吗?显著差异:
- 本地操作系统:Windows 7,主机操作系统:Windows Server 2012
- 本地IIS:7,主机IIS 8(.5?)
这个问题已经解决了。在web场中的一个节点上重新启动后,将不再显示此行为。这并没有让我充满信心,因为如果它再次发生,我不知道如何解决它。我欢迎您提供一些答案,这些答案可以说明为什么会出现这种情况……我会在IIS管理器上查看设置是否不同,但您可以在web.config上设置明确的请求长度值,并提供一些详细信息。这个老问题可能会提供一些提示: