微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

ASP.NET Core http请求内容过大, IIS服务器 返回 Request Too Long 解决方案

1、修改web.config文件内容如下:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <location path="." inheritInChildApplications="false">
    <system.webServer>
      <handlers>
        <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
      </handlers>
      <aspNetCore processpath="dotnet" arguments=".\ZXIT.YDJW.WebServer.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="inprocess" />
      
        <security>
              <requestfiltering>
                <!-- Measured in Bytes -->
                <requestLimits maxQueryString="1073741824" />
              </requestfiltering>
       </security>
      
    </system.webServer>
  </location>
</configuration>
<!--ProjectGuid: 960a6dae-a9b5-42a9-a89c-53e685724991-->

 

2、后台接收解除文件大小限制

        [HttpPost]
        [disableRequestSizeLimit]
        public IActionResult SendNotice(string content)
        {
            return Json(new { msg = "ok", info = content });
        }

 

 

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐