【问题标题】:Why is IIS app pool stopping after long request?为什么 IIS 应用程序池在长时间请求后停止?
【发布时间】:2022-02-09 16:26:44
【问题描述】:

我创建了一个 API,它调用其他 API 并返回一个很长的字符串(大约 200mb)。
每次我向它发出请求时,它都需要很长时间才能运行,然后只响应 4mb(精确)的响应并关闭应用程序池。

我尝试了这些解决方案:

  • 将executionTimeout 和shutdownTimeout 增加到01:00:00
  • 将bufferingOn 设置为false,将bufferingLimit 设置为1073741824
  • 禁用Rapid-Fail Protection

<?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=".\Program.exe" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="inprocess" />
    </system.webServer>
  </location>
    <system.web>
        <httpRuntime executionTimeout="3600" shutdownTimeout="3600" />
    </system.web>
</configuration>
<location path="Internal Interfaces">
    <system.webServer>
        <asp bufferingOn="false">
            <limits bufferingLimit="1073741824" />
        </asp>
    </system.webServer>
</location>

谢谢,
卡伦

【问题讨论】:

    标签: asp.net-core-webapi iis-10


    【解决方案1】:

    您可以尝试此设置以增加 iis 中的请求限制。

    IIS 设置:请求限制:

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

    使用上面的 maxAllowedContentLength,用户可以上传 2 GB 大小的文件。

    使用 IIS 管理器编辑请求过滤功能设置和请求限制:

    1. 打开 IIS 管理器。
    2. 选择您要配置的网站。
    3. 选择请求过滤并双击图标将其打开。将显示“请求筛选”窗格。
    4. 在屏幕右侧的“操作”窗格中,单击“编辑功能设置...”链接。将显示“编辑请求过滤设置”窗口。
    5. 在“请求限制”部分,输入适当的最大允许内容长度(字节),然后单击“确定”按钮。
    6. 重新启动 IIS。

    【讨论】:

    • 您好@samwu,感谢您的回答。我尝试提高最大允许内容长度参数,但它没有用。我的问题更多是响应长度被削减到 4mb(然后应用程序池关闭)
    猜你喜欢
    • 2015-08-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-09-15
    • 2018-11-04
    • 1970-01-01
    • 1970-01-01
    • 2017-08-29
    相关资源
    最近更新 更多