每个应用程序可以运行多少个Application对象实例 [英] How many instances of an Application object can run per application

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

问题描述

我正在阅读以下帖子如何正确使用IHttpModule
*

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


现在让我们想一想这个词本身。应用程序池。是的游泳池。它
表示某个Web应用程序在一个池中运行多个
HttpApplication实例。是多个。否则,
将不会被称为池。 »你可以问多少?只要你知道可能不止一个,这不是
真的很重要。我们
信任IIS来完成它的工作。它显然做得很好,它使
这个事实对我们的开发人员来说完全透明,因此没有多少
完全理解它的内部工作原理。我们依靠其坚固性来提供
的服务。确实如此。池中的每个HttpApplication
实例都保留了自己的HTTP模块列表,它使用的每个请求都使用

Now lets think of the word itself. Application pool. Yes pool. It means that a certain web application is running multiple HttpApplication instances in one pool. Yes multiple. Otherwise it wouldn't be called a pool. »How many?« you may ask. That doesn't really matter as long as you know there could be more than one. We trust IIS to do its job. And it obviously does it so well that it made this fact completely transparent for us developers hence not many completely understand its inner workings. We rely on its robustness to provide the service. And it does. Each of these HttpApplication instances in the pool keeps its own list of HTTP modules that it uses with each request it processes.

*

我有一个问题,即在什么情况下可以为单个应用程序运行多个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对象实例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆