[英]Web Service error : HTTP 413: Request Entity Too Large
我的系统:
IIS 7.5
视觉工作室 2010
框架 4
我制作了一个接收文件(字节数组)的 Web 服务。 我制作了一个使用它的控制台应用程序(添加服务参考--> 高级--> 添加 Web 参考)。 使用http它可以完美运行。 但我需要用 https 来消费它。 因此,当我尝试使用 https 使用它时,它给了我 HTTP 413:请求实体太大。 我已经阅读了很多,但这是不可能的。 我试图放入Web服务的webconfig:
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_INopService" maxReceivedMessageSize="22147483647" maxBufferPoolSize="252428800" maxBufferSize="22147483647">
<readerQuotas maxDepth="256" maxStringContentLength="22147483647" maxArrayLength="2222216384"
maxBytesPerRead="2222220000" maxNameTableCharCount="2222216384" ></readerQuotas>
</binding>
</basicHttpBinding>
<basicHttpBinding>
<binding name="HttpBigMessage"
receiveTimeout="00:10:00"
sendTimeout="00:10:00"
maxReceivedMessageSize="2147483647" >
<security mode="None" />
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="https://localhost/hmenu/GetData.asmx"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_INopService"
contract="PhotoSavingsService.INopService" name="BasicHttpBinding_INopService" />
</client>
</system.serviceModel>
文件不是太大。 我需要把最大尺寸放在哪里?
感谢
多次通过添加行
<httpRuntime maxRequestLength="214748364" executionTimeout="9999"
targetFramework="4.5"/>
给出 500 错误
请找出您的 web 配置文件中已经存在的内容 大家好,如果 web.config 中的任何错误配置首先修复,通常会出现 500 错误。 在这里,我在 https 协议问题修复中提供了 413 实体太大
问题修复前的 web.config
<bindings>
<webHttpBinding>
<binding name="RestServiceBindingConfig">
<security mode="Transport"></security>
</binding>
<binding name="HttpRestServiceBindingConfig">
<security mode="None"></security>
</binding>
<binding maxBufferPoolSize="76000000" maxReceivedMessageSize="19000000">
<readerQuotas maxDepth="32" maxStringContentLength="19000000"
maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"/>
</binding>
</webHttpBinding>
</bindings>
<behaviors>
我们只是在传输模式 RestServiceBindingConfig 中复制粘贴的 readerquotas maxBufferPoolSize maxReceivedMessageSize 这使得技巧首先 RestServiceBindingConfig 用于 https 第二个 HttpRestServiceBindingConfig 绑定用于 http
问题修复后的 web.config
<bindings>
<webHttpBinding>
<binding name="RestServiceBindingConfig" maxBufferPoolSize="2147483647"
maxReceivedMessageSize="2147483647">
<readerQuotas maxDepth="32" maxStringContentLength="2147483647"
maxArrayLength="2147483647" maxBytesPerRead="4096"
maxNameTableCharCount="16384" />
<security mode="Transport"></security>
</binding>
<binding name="HttpRestServiceBindingConfig"
maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647">
<readerQuotas maxDepth="32" maxStringContentLength="2147483647"
maxArrayLength="2147483647" maxBytesPerRead="4096"
maxNameTableCharCount="16384" />
<security mode="None"></security>
</binding>
</webHttpBinding>
</bindings>
<behaviors>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.