远程服务器返回意外响应:(413) WCF 中的请求实体太大

本文关键字:WCF 请求 实体 返回 服务器 意外 响应 | 更新日期: 2023-09-27 18:34:30

当我尝试使用 Tinymce 编辑器保存大文本时,我的 WCF 服务遇到问题,它说远程服务器返回意外响应:(413( 请求实体太大。

最大尺寸已经在配置中,这里还有什么遗漏的吗?

提前谢谢。

端点如下,

<endpoint name="LabServiceEndPoint" address="***" binding="basicHttpBinding" contract="EasternLabs.Common.Contract.ServiceContracts.ILabServices" bindingConfiguration="Binding1" />

我的绑定,

<basicHttpBinding>
        <binding name="Binding1" hostNameComparisonMode="StrongWildcard" receiveTimeout="00:10:00" sendTimeout="00:10:00" openTimeout="00:10:00" closeTimeout="00:10:00" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" maxBufferPoolSize="2147483647" transferMode="Buffered" messageEncoding="Text" textEncoding="utf-8" bypassProxyOnLocal="false" useDefaultWebProxy="true">
          <security mode="None" />
          <readerQuotas
                 maxDepth="2147483647"
                 maxStringContentLength="2147483647"
                 maxArrayLength="2147483647"
                 maxBytesPerRead="2147483647"
                 maxNameTableCharCount="2147483647" />
        </binding>
      </basicHttpBinding>

远程服务器返回意外响应:(413) WCF 中的请求实体太大

您的配置似乎还可以,所以我认为您的问题是MaxRequestEntityAllow

http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/468d6cea-04cd-4b10-b1e1-c17b9e909d07.mspx?mfr=true

尝试通过cmd设置它

cmd appcmd set config /section:asp /maxRequestEntityAllowed:4294967295

它会将其设置为 4gb - 如果您想要更低的限制,请更改数字。

这对 DoS 不利