每个应用程序可以运行多少个Application对象实例

每个应用程序可以运行多少个Application对象实例

本文介绍了每个应用程序可以运行多少个Application对象实例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在阅读以下帖子
*

I was reading the following post How to correctly use IHttpModule*

*

我有一个问题,即在什么情况下可以为单个应用程序运行多个Application对象实例。直到现在我才意识到每个应用程序都存在一个应用程序对象。所以我很想知道这是真的,每个应用程序可以运行多个实例以及如何决定它?

I have a question that under what scenario multiple instances of an Application object can run for a single application. Till now I was aware of the fact that a single application object exists per application. So I am curious to know that is this true that multiple instances can run per application and how it is decided ?

推荐答案

每个 HttpApplication 对象实例对于单个是唯一的请求即可。如果您的站点并行处理多个请求,则每个请求必须拥有自己的 HttpApplication 实例。该对象具有在请求的生命周期内不得更改的每请求状态信息(包括请求和响应的主体!)

Each HttpApplication object instance is unique to a single request. If your site is processing multiple requests in parallel, each one must have it's own instance of HttpApplication. That object has per-request state information that must not change during the request's lifetime (including the body of the request and response!)

实例汇集在一起​​,如这篇文章。每个请求都将被重用,以便为多个后续请求提供服务,直到应用程序池上设置的限制,然后它将被允许死掉。

The instances are pooled, as described in the article. Each one will be reused to service multiple subsequent requests, up to the limit set on the application pool, then it'll be allowed to die off.

请注意你'重新具体询问HttpApplication。这与 System.Windows.Forms.Application 类不同,后者实际上是一个单独的类,每个应用程序只存在一次。

Note that you're specifically asking about HttpApplication. This is distinct from the System.Windows.Forms.Application class, which is in fact a singleton class that only exists once per application.

这篇关于每个应用程序可以运行多少个Application对象实例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-28 06:55