Asp.net 上传文件报“超过最大请求长度”黄页,解决方法随笔

客户在软件使用过程中上传文件操作时反应报错,无法上传。查找原因是报“超过最大请求长度”和“超出json长度”错误,判断是base64加密后的路径太长和文件超过4M导致的。

做了三个地方参数配置来解决问题;

1、maxRequestLength

 

<system.web>
  <httpRuntime targetFramework="4.5" maxRequestLength="2097151" />
</system.web>

2、maxAllowedContentLength

<system.webServer>
  <security>
    <requestFiltering >
      <requestLimits maxAllowedContentLength="2147483647" ></requestLimits>
    </requestFiltering>
  </security>
</system.webServer>

3、maxJsonLength

<system.web.extensions>
    <scripting>
        <webServices>
            <jsonSerialization maxJsonLength="1024000000" />
        </webServices>
    </scripting>
</system.web.extensions>

 

posted @ 2021-12-23 11:26  上山下水  阅读(163)  评论(0编辑  收藏  举报