Web Services Web服务错误:HTTP 413:请求实体太大

0ejtzxu1  于 2022-11-15  发布在  其他
关注(0)|答案(1)|浏览(207)

我 的 系统 :
互联 网 信息 服务 7.5
Visual Studio 2010 开发 工具
框架 四
我 做 了 一 个 接收 文件 ( 字节 数组 ) 的 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>

中 的 每 一 个
文件 不 太 大 。 我 需要 把 最 大 大小 放在 哪里 ?
谢谢

mxg2im7a

mxg2im7a1#

多次通过添加行

<httpRuntime maxRequestLength="214748364" executionTimeout="9999" 
targetFramework="4.5"/>

给出500个错误
请找出哪个是already存在于您的web配置文件嗨,伙计们通常500错误发生,如果有任何错误的配置在web.config修复第一.这里我提供413实体太大的https协议问题修复

修复问题之前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>

我们只是复制粘贴了reader quotas maxBufferPoolSize maxReceivedMessageSize在传输模式中的RestServiceBindingConfig这使技巧第一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>

相关问题