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=".XIT.YDJW.WebServer.dll" stdoutLogEnabled="false" stdoutLogFile=".logsstdout" 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 });
        }

原文地址:https://www.cnblogs.com/majiabin/p/15220070.html