简体   繁体   English

c# - 远程服务器返回了意外响应:(413) 请求实体太大

[英]c# - The remote server returned an unexpected response: (413) Request Entity Too Large

I am trying to create an windows application which will capture the screen periodically and convert the image as binary and send it through WCF service.我正在尝试创建一个 Windows 应用程序,它将定期捕获屏幕并将图像转换为二进制文件并通过 WCF 服务发送它。 WCF save this value in SQL database. WCF 将此值保存在 SQL 数据库中。

I cannot able to send through the WCF Service it throwing the error.我无法通过 WCF 服务发送它抛出错误。 Other than the binary image, I send the user name only.除了二进制图像,我只发送用户名。

I checked the total service size is about 200kb, also in web.config file I gave allowed size of maxReceivedMessageSize="2000000"(2MB).我检查了总服务大小约为 200kb,也在 web.config 文件中我给出了 maxReceivedMessageSize="2000000"(2MB) 的允许大小。

<bindings>
        <basicHttpBinding>
            <binding name="sslBinding" maxReceivedMessageSize="2000000" maxBufferSize="2000000">
                <readerQuotas maxArrayLength="2000000" maxStringContentLength="2000000" />
                <security mode="Transport" >
                  <transport clientCredentialType="None" proxyCredentialType="None" realm=""/>
                </security>
            </binding>
        </basicHttpBinding>
    </bindings>

Tried:尝试:

  • Removed the binding name删除了绑定名称
  • Even gave maxReceivedMessageSize is 5MB.甚至给了 maxReceivedMessageSize 是 5MB。

I don't want to change basicHttpBinding to webHttpBinding, because other services are running in the same application.我不想将 basicHttpBinding 更改为 webHttpBinding,因为其他服务正在同一应用程序中运行。

I have referred the questions 30890220 and 44234761我已经提到了问题3089022044234761

Try using this for your binding:尝试将其用于您的绑定:

      <basicHttpBinding>
    <binding maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" messageEncoding="Text">
      <readerQuotas maxDepth="2000000" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
    </binding>
  </basicHttpBinding>

I know you already modified maxReceivedMessageSize, so with the above you're also tampering with readerQuotas.我知道你已经修改了 maxReceivedMessageSize,所以在上面你也篡改了 readerQuotas。

You can also try increasing the uploadReadAheadSize in IIS:您还可以尝试增加 IIS 中的 uploadReadAheadSize:

<location path="THENAMEOFTHESITEYOUHAVE" overrideMode="Allow">
<system.webServer>
    <asp />
    <serverRuntime uploadReadAheadSize="2147483647" />
</system.webServer>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 远程服务器返回了意外的响应:(413)请求实体太大 - The remote server returned an unexpected response: (413) Request Entity Too Large WCF 4.5:发生意外错误:远程服务器返回了意外响应:(413)请求实体太大 - WCF 4.5: An unexpected error occurred: The remote server returned an unexpected response: (413) Request Entity Too Large 错误:远程服务器返回了意外的响应:(413)请求实体太大 - Error: the remote server returned an unexpected response: (413) Request Entity Too Large 远程服务器返回意外响应:(413) 请求实体太大。 - The remote server returned an unexpected response: (413) Request Entity Too Large. WCF:远程服务器返回了意外的响应:(413)请求实体太大 - WCF : The remote server returned an unexpected response: (413) Request Entity Too Large 远程服务器返回意外响应:(413)请求实体太大。? - The remote server returned an unexpected response: (413) Request Entity Too Large.? System.ServiceModel.ProtocolException:远程服务器返回了意外的响应:(413)请求实体太大 - System.ServiceModel.ProtocolException: The remote server returned an unexpected response: (413) Request Entity Too Large 远程服务器返回意外响应:(413) Request Entity too Large in wsHttpBinding - The remote server returned an unexpected response: (413) Request Entity too Large in wsHttpBinding 上载大图像时WCF服务错误-远程服务器返回意外响应:(413)请求实体太大 - WCF service error while uploading large images - the remote server returned an unexpected response: (413) request entity too large WCF服务返回意外响应:(413)请求实体太大 - Unexpected response returned by WCF Service: (413) Request Entity Too Large
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM