我正在尝试限制在 Windows Server 2008 上在 IIS7.5 下运行的 ASP.NET MVC 应用程序允许的托管线程数。我尝试了多种不同的方法,但似乎都没有按预期工作,我需要限制报告的线程数
Threading.Thread.CurrentThread.ManagedThreadId
我还尝试更改每个处理器限制的 ASP/行为/限制属性/线程,但我仍然得到具有不同线程 ID 的新线程。
我真的需要有限数量的线程(比如 5-10 个),每次使用时每个线程都具有相同的线程 ID。
目前我有以下配置文件
<configuration>
<system.web>
<applicationPool maxConcurrentRequestsPerCPU="1" maxConcurrentThreadsPerCPU="1" requestQueueLimit="5000"/>
</system.web> </configuration>
由 applicationhost.config 指向
<applicationPools>
<add name="DefaultAppPool" enable32BitAppOnWin64="true" CLRConfigFile="C:\Inetpub\wwwroot\SCRWeb\Data\apppool.config">
<processModel identityType="NetworkService" />
</add>
但我仍然在我的应用程序中看到超过 1 个线程 id,正如 Threading.Thread.CurrentThread.ManagedThreadId 所报告的那样
有任何想法吗?
谢谢