多个 httpmodule 实例

发布于 2024-07-14 15:03:28 字数 292 浏览 2 评论 0原文

我有一个使用 Web 应用程序的 asp.net 网站,它们都位于同一个应用程序池中(有 1 个工作进程)。 该网站的 web.config 文件中加载了一个 httpmodule,奇怪的是主网站和应用程序都将由 httpmodule 的单独实例提供服务。 为什么是这样? 由于它们位于同一进程中,因此似乎它们应该使用一个实例。

另外,如果我尝试在应用程序中使用静态变量,它们将指向与 asp.net 网站中不同的对象。 与之前相同的问题,因为它们位于同一个进程中,它们不应该是同一个对象吗?还是 .net 在进程内部强加了某种边界?

I have an asp.net website that uses a web application and they are both in the same application pool (with 1 worker process). The website has a httpmodule loaded in it's web.config file and curiously both the main website and the application will be served by seperate instances of the httpmodule. Why is this? Since they are in the same process it seems like they should use one instance.

Also, if I try to use static variables in the application they will point to different objects than in the asp.net website. Same question as before since they are in the same process shouldn't they be the same object or does .net imposs some sort of boundary inside of the process?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

淡看悲欢离合 2024-07-21 15:03:28

IIS 为每个应用程序创建一个单独的AppDomain。 这些 AppDomain 位于同一操作系统进程内,但从托管代码的角度来看,可以将其视为单独的进程。 即它们不共享加载的程序集、内存等。

http://www.odetocode.com /articles/305.aspx
http://weblogs.asp.net/ owscott/archive/2007/09/02/application-vs-appdomain.aspx
http://msdn.microsoft.com/en -us/library/system.appdomain(VS.85).aspx

IIS creates a seperate AppDomain for each applicatiopn. These AppDomains live inside the same operating system process, but can be treated like separate processes from the viewpoint of your managed code. I.e. they don't share loaded assemblies, memory, etc.

http://www.odetocode.com/articles/305.aspx
http://weblogs.asp.net/owscott/archive/2007/09/02/application-vs-appdomain.aspx
http://msdn.microsoft.com/en-us/library/system.appdomain(VS.85).aspx

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文