[英]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:尝试:
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我已经提到了问题30890220和44234761
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.