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>

 

顺利解决问题。


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM