什么是应用程序池和工作进程线程之间的关系?
我在ASP.NET应用程序故障排除重新启动。该应用程序正在重新启动,每天约20次。我们强烈怀疑应用程序的一个组成部分,因为重新启动时投入生产开始了,当这个特殊的功能。我已经添加了一些日志记录,使用log4net的库这些网页,但我有麻烦间preting日志。
I'm troubleshooting restarts in an ASP.NET application. The application is restarting about 20 times a day. We strongly suspect one part of the application because the restarts began when this particular feature when into production. I've added some logging to those pages using the log4net library, but I'm having trouble interpreting the logs.
当ASP.NET应用程序是在应用程序池中运行,也只有该应用程序运行的一个实例,或将在该应用程序的多个实例上运行?我知道有几家工作进程线程将被催生。什么是工作进程线程在应用程序池运行的应用程序(S)之间的关系?
When an ASP.NET application is running in an Application Pool, does only a single instance of that application run, or will multiple instances of that application run? I know several worker process threads will be spawned. What is the relationship of the worker process threads to the application(s) running in the App Pool?
我在想,我可能不是跨preting如果正确有多个应用程序记录到相同的日志结果。如果一个人被重新启动,但对方不是,日志是不是真的告诉我很多关于重启时发生了什么事。
I am thinking that I may not be interpreting the results correctly if there are multiple applications logging to the same log. If one is restarted but the other is not, the logs aren't really telling me much about what was happening when the restart occurred.
更新1
看着此页面,我发现了以下信息:
Looking at this page, I find the following information:
应用程序池定义一组的一个或多个工作进程,与该服务请求分配给应用程序池的一个或多个应用程序常用的设置进行配置。由于应用程序池允许一组Web应用程序共享一个或多个类似配置的工作进程,它们提供了一种方便的方法来隔离一组从服务器计算机上的其他Web应用程序的Web应用程序。进程边界分隔每个工作进程;因此,在一个应用程序池的应用程序问题不会影响其他应用程序池中的网站或应用程序。
An application pool defines a group of one or more worker processes, configured with common settings that serve requests to one or more applications that are assigned to that application pool. Because application pools allow a set of Web applications to share one or more similarly configured worker processes, they provide a convenient way to isolate a set of Web applications from other Web applications on the server computer. Process boundaries separate each worker process; therefore, application problems in one application pool do not affect Web sites or applications in other application pools.
但我仍然困惑。我知道从我可以分配两个完全不同的应用程序使用相同的应用程序池的经验。这是否意味着,正好有两个工作进程将催生?或者能有催生的第一个应用程序的多个工作进程和多个工作进程催生了第二个应用程序?如果问题在一个工作进程情况,可以把它取下来每一个应用程序在应用程序池运行?
But I am still confused. I know from experience that I can assign two entirely different applications to use the same App Pool. Does that mean that exactly two worker processes will be spawned? Or can there be multiple worker processes spawned for the first app, and multiple worker processes spawned for the second app? If a problem happens in one worker process, can it take down every application running in that App Pool?
更新2
此页有关使用WinDbg的 ,我发现这个信息(重点煤矿):
From this page about using WinDbg, I found this information (emphasis mine):
在IIS 5.x中,仅存在一个Aspnet_wp.exe辅助过程和一个调试器线程。因此,只有一个调试器可以同时被连接到Aspnet_wp.exe进程。如果你正在处理在同一台机器上的多个Web应用程序,这会造成问题。在IIS 6.0中,可以强制一个AppDomain在一个单独的应用程序池中运行。 (有关更多信息,请参阅IIS 5.x的过程模型,并在第1章IIS 6.0进程模型)的单独的应用程序池提供了多种的W3wp.exe进程。在这些创建多线程调试流程(每个),让您更有效地进行调试。
In IIS 5.x, there is only one Aspnet_wp.exe worker process and one debugger thread. Consequently, only one debugger can be attached to the Aspnet_wp.exe process at a time. This can pose a problem if you're dealing with multiple Web applications on the same machine. In IIS 6.0, you can coerce an AppDomain to run in a separate application pool. (For more information, see "IIS 5.x Process Model" and "IIS 6.0 Process Model" in Chapter 1.) Separate application pools provide multiple W3wp.exe processes. Multiple debugger threads are created in these processes (one in each), allowing you to debug more efficiently.
这听起来好像每一个应用程序池得一的w3wp.exe
过程。我是跨preting,对吗?如果是这样,这是否仍然适用于IIS 7.5?
This sounds to me like each App Pool gets one w3wp.exe
process. Am I interpreting that right? And if so, does that still apply in IIS 7.5?
是的,每个应用程序池的一般的单个进程 1 ,但可以包含多个线程。您可以分配多个站点一个应用程序池,这些网站将在同一进程下的所有运行,但他们会在不同的应用程序域,这是从另一个单独的一个网站上的code的安全上下文中运行,即使如果他们在相同的应用程序池中运行。
Yes, each application pool is typically a single process1, but can contain multiple threads. You can assign multiple sites to an application pool, and those sites will all run under the same process, however they will run under different "app domains", which are security contexts that separate the code of one site from another, even if they're running on the same app pool.
两个用户击中同时该网站可以在不同的线程中运行,这意味着它们可以同时运行。这意味着任何记录可以有值穿插。您可能希望会话值添加到您的记录,以便您可以排序基于会话。
Two users hitting the site at the same time can run on different threads, meaning they can run concurrently. That means any logging can have values interspersed. You might want to add a session value to your logging so you can sort based on session.
应用程序池重新启动(回收)都是正常的,在一天20重启似乎并不寻常。他们可以发生,每天多次,并且重新启动应用程序池时IIS控制。它这样做的时候,感觉它需要清理游泳池。 2 您的应用程序应该以这样的方式,以优雅的恢复从这个(即不要将一切都在会话不能轻易如果应用程序池重新启动重建)。
App pool restarts (recycling) are normal, 20 restarts in a day does not seem unusual. They can happen multiple times per day, and IIS controls when app pools are restarted. It does this whenever it feels it needs to clean up the pool.2 Your applications should be written in such a way as to recover gracefully from this (ie, do not keep anything in session that cannot be easily recreated if the app pool restarts).
当未处理的异常在你的应用程序时,会出现应用程序池也可以重新启动。在这种情况下,要解决这个原因。这样的异常通常会记录在事件日志中。
The app pool can also restart when an unhandled exception occurs in your app. In that case, you want to address the cause of this. Such exceptions are usually logged in the event log.
1&ndash的;当你的可以的配置应用程序池有多个工作进程(这就是所谓的网络花园),这不是一个典型的(也不是一般建议)以我的经验配置
1 – While you can configure an application pool to have multiple worker processes (this is known as a Web Garden), this is not a typical (nor generally recommended) configuration in my experience.
2&ndash的;请注意,使用IIS管理器,您可以配置一个应用程序来登录回收事件Windows事件日志的。您还可以使用IIS管理器来设置阈值时几个不同类型的循环的事件发生了。
2 – Note that using IIS Manager you can configure an application to log recycle events to the Windows Event Log. You can also use IIS Manager to set the threshold for when several of the different types of recycle events occur.