IIS App Pools & Static Classes

落花浮王杯 提交于 2019-12-22 04:08:03

问题


I've always wondered, lets say you have two asp.net websites running in the same app pool.

Lets call them Website 1 and Website 2

Both of these websites reference some shared code, lets call it Awesome.dll

Lets say that Awesome.dll contains a class defined as below

public static class Foo
{
   public static string Bar { get; set; }
}

My question:

Do both websites share the same static class or do they have their own isolated copy? That is to say, if Website 1 makes a change to Foo.Bar, is that change reflected in website 2?


回答1:


My understanding is that while the websites will be in the same App Pool, they'll still be in their own App Domain. That means they can't see each other's objects, and each one will have it's own instantiation of the static class.




回答2:


Each Application include(WebSite) is running AppDomain and static data with in context of appdomain though web application are running same application pool

So Web Site2 will not reflect with changes made in Web Site.



来源:https://stackoverflow.com/questions/11071067/iis-app-pools-static-classes

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!