【问题标题】:Does ThreadPool.GetMaxThreads get the value based on processModel tag in machine.config?ThreadPool.GetMaxThreads 是否根据 machine.config 中的 processModel 标签获取值?
【发布时间】:2012-03-21 06:33:14
【问题描述】:

我已将 machine.config 中的 maxIoThreads 和 maxWorkerThreads 设置为 100。

<processModel autoConfig="false" maxWorkerThreads="100" maxIoThreads="100"/>

但是,当我在 Visual Studio 中调试 ASP.net 4.0 Web 应用程序代码时,我看到 ThreadPool.GetMaxThreads 返回的计数均为 200。

        int workerThreads;
        int portThreads;
        System.Threading.ThreadPool.GetMaxThreads(out workerThreads, out portThreads);
        //workerThreads & portThreads both get the value of 200

我的问题是 machine.config 中的 processmodel 标签和 ThreadPool.GetMaxThreads 之间有什么关系吗?

【问题讨论】:

    标签: asp.net .net .net-4.0 asp.net-4.0 threadpool


    【解决方案1】:

    查看http://msdn.microsoft.com/en-us/library/7w2sway1.aspx

    maxWorkerThreads = 在每个 CPU 的基础上配置用于进程的最大工作线程数。例如,如果在单处理器服务器上此值为 25,则 ASP.NET 使用运行时 API 将进程限制设置为 25。在双处理器服务器上,限制设置为 50。

    此外,请确保您已根据本指南在 httpruntime 中定义了 minFreeThread

    此属性的值必须等于或大于 httpRuntime 配置部分中的 minFreeThread 属性设置。

    【讨论】:

      猜你喜欢
      • 2011-06-13
      • 2016-09-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多