asp.net 问题:Web 服务器上的请求筛选模块被配置为 拒绝包含的查询字符串过长的请求

发现问题:

post请求,在发送一个图片base64编码的字符串时,服务端报这个错误。

报错信息中给出了解决办法:

最可能的原因:

Web 服务器上的请求筛选被配置为拒绝该请求,因为查询字符串过长。

可尝试的操作:

确认 applicationhost.config 或 web.config 文件中的 configuration/system.webServer/security/requestFiltering/requestLimits@maxQueryString 设置。

解决问题:

参考了博客:https://www.cnblogs.com/mengtree/p/5255177.html

最后修改了项目中 web.config 配置文件,添加了如下内容。

<system.web>
    <compilation debug="true" targetFramework="4.5" />
    <httpRuntime targetFramework="4.5" maxRequestLength="102400" maxQueryStringLength="102400" />
  </system.web>
  <system.webServer>
    <security>
      <requestFiltering>
        <requestLimits maxAllowedContentLength="2147483647" maxQueryString="2147483647" />
      </requestFiltering>
    </security>
  </system.webServer>

顺利解决问题。

原文地址:https://www.cnblogs.com/gangler/p/10058352.html