c# - IIS7线程是如何分配的?

标签 c# asp.net iis-7

我将 log4net 添加到我的应用程序,现在可以在用户浏览我的网站时查看用户事件的线程 ID。是否有关于 IIS7 如何进行线程分配的任何特定算法,或者它只是一个随机数分配(我怀疑它不是完全随机的,因为我的低流量站点显示线程主要在 10-30 范围内)?可用线程数的最大值是多少?我注意到我的调度程序显示了一个奇怪的线程 ID——这有什么原因吗?调度程序是 Quartz.net,id 显示为“Scheduler_Worker-10”,而不仅仅是一个数字。

最佳答案

This解释所有你需要知道的。

摘录:

When ASP.NET is hosted on IIS 7.0 in integrated mode, the use of threads is a bit different. First of all, the application-level queues are no more. Their performance was always really bad, there was no hope in fixing this, and so we got rid of them. But perhaps the biggest difference is that in IIS 6.0, or ISAPI mode, ASP.NET restricts the number of threads concurrently executing requests, but in IIS 7.0 integrated mode, ASP.NET restricts the number of concurrently executing requests. The difference only matters when the requests are asynchronous (the request either has an asynchronous handler or a module in the pipeline completes asynchronously). Obviously if the reqeusts are synchronous, then the number of concurrently executing requests is the same as the number of threads concurrently executing requests, but if the requests are asynchronous then these two numbers can be quite different as you could have far more reqeusts than threads.

所以基本上,如果请求是同步的,则每个请求的线程数相同。各种看这里parameters .

关于c# - IIS7线程是如何分配的?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4910159/

相关文章:

c# - 独立项目中的 ASP.NET 5 Web 项目和 Entity Framework

c# - 无法使用 nhibernate 找到 validatorengine 命名空间,

c# - 尝试访问 .ashx 文件时出现 500 Internal Server Error

c# - `KeyValuePair<string, int>` 的默认值是多少?

c# - 如何在 GridView 中创建删除按钮?

c# - 如何处理带有空参数的 ScriptManager AddHistoryPoint?

model-view-controller - 如何在 IIS 7.5 的 MVC 2 中混合使用表单例份验证和 Windows 身份验证?

asp.net-mvc - 我想使用 ASP.Net MVC。我的服务器是 Win 2003,它使用 IIS 6,所有这些都可以一起工作吗?

c# - 将 UI Thread 方法传递给另一个线程以在 C# 中调用

c# - 在 View 中显示来自 Controller 的 json 数据