【问题标题】:Internal server error 500 when tweaking web.config using maxWorkerThreads使用 maxWorkerThreads 调整 web.config 时出现内部服务器错误 500
【发布时间】:2019-10-20 03:37:55
【问题描述】:

我想提高 IIS 上 ASP.NET Web 应用程序的性能。有时当许多用户连接到它时,它会变得太慢。这个应用程序使用默认的 InProc 模式作为会话状态。在尝试网络花园或网络农场之前,我决定尝试其他替代方法,例如在 system.web 部分下的 web.config 文件中调整以下参数:

<system.web>  
    <processModel maxWorkerThreads="100" maxIoThreads="100" minWorkerThreads="50"/>

    <httpRuntime minFreeThreads="704" minLocalRequestFreeThreads="608"/>
</system.web>

设置这些参数后,我无法访问 ASP.NET 应用程序,出现错误 500 internal server error。

如果我删除上述设置,应用程序可以工作。

服务器是一个虚拟机,它有一个带有 12 个虚拟处理器的 Intel® Xeon® Processor E5 v3。

有什么想法吗?

【问题讨论】:

    标签: asp.net asp.net-mvc iis http-error tweak


    【解决方案1】:

    我终于解决了。

    为了下面的行工作:

    <processModel maxWorkerThreads="100" maxIoThreads="100" minWorkerThreads="50"/>
    

    ...需要在 machine.config 文件中进行修改:

    systemroot\Windows\Microsoft.NET\Framework\VersionNumber\Config
    systemroot\Windows\Microsoft.NET\Framework64\VersionNumber\Config
    

    其中 VersionNumber 对应于您正在使用的 .NET Framework 版本,在我的例子中是 v4.0.30319

    您必须将 Machine.config 文件中 processModel 部分的 allowDefinition 从 MachineOnly 更改为 MachineToApplication:

    <section name="processModel" type="System.Web.Configuration.ProcessModelSection, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" allowDefinition="MachineToApplication" allowLocation="false" />
    

    最后,罪魁祸首是因为下面的行不起作用:

    <httpRuntime minFreeThreads="704" minLocalRequestFreeThreads="608"/>
    

    ...是因为这一行在 web.config 文件的下面几行被复制为:

    <httpRuntime targetFramework="4.5" maxRequestLength="102400" executionTimeout="3600" maxQueryStringLength="8192" />
    

    所以我把它们组合成下面的一个:

    <httpRuntime targetFramework="4.5" minFreeThreads="704" minLocalRequestFreeThreads="608" maxRequestLength="102400" executionTimeout="3600" maxQueryStringLength="8192" />
    

    感兴趣的链接

    【讨论】:

      猜你喜欢
      • 2023-03-15
      • 2015-07-05
      • 1970-01-01
      • 1970-01-01
      • 2016-03-26
      • 2020-02-06
      • 1970-01-01
      • 2017-04-16
      • 2019-03-21
      相关资源
      最近更新 更多