Application Pool 与 AppDomain 区别
来源:互联网 发布:nodejs部署到windows 编辑:程序博客网 时间:2024/05/23 02:00
Application Pool 与 AppDomain 区别
I saw a lot of people asking what's the differences between Application Pool and AppDomain in ASP.NET.
First of all, Application Pool is a concept in IIS, but AppDomain is a concept in .NET. You can write you own program to use 2 or more AppDomaines.
I did a test with the IIS7 Asp.net 2.0 on my Vista computer.
Here is the test code:
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
string info;
info = "Current Process Name:" + Process.GetCurrentProcess().ProcessName + "</br>";
info += "Current Process Id:" + Process.GetCurrentProcess().Id + "</br>";
{
protected void Page_Load(object sender, EventArgs e)
{
string info;
info = "Current Process Name:" + Process.GetCurrentProcess().ProcessName + "</br>";
info += "Current Process Id:" + Process.GetCurrentProcess().Id + "</br>";
info += "Current Application Domain:"+AppDomain.CurrentDomain.FriendlyName + "</br>";
info += "Current Application Domain Base Dir:"+AppDomain.CurrentDomain.BaseDirectory + "</br>";
divInfo.InnerHtml = info;
}
}
info += "Current Application Domain Base Dir:"+AppDomain.CurrentDomain.BaseDirectory + "</br>";
divInfo.InnerHtml = info;
}
}
Now, I created 2 application pools called AppPool1 and AppPool2;
Then I created 3 applications called AppTest1, AppTest2 and AppTest3. All of them point to the same directory where my sample is.
I put AppTest1 under AppPool1, AppTest2 and AppTest2 under AppPool2.
Here is the result:
http://localhost/AppTest1/Default.aspx
Current Process Name:w3wp
Current Process Id:3784
Current Application Domain:/LM/W3SVC/1/ROOT/AppTest1-2-128701111683637820
Current Application Domain Base Dir:C:/inetpub/wwwroot/AppTest/
Current Process Id:3784
Current Application Domain:/LM/W3SVC/1/ROOT/AppTest1-2-128701111683637820
Current Application Domain Base Dir:C:/inetpub/wwwroot/AppTest/
http://localhost/AppTest2/Default.aspx
Current Process Name:w3wp
Current Process Id:5044
Current Application Domain:/LM/W3SVC/1/ROOT/AppTest2-1-128701111868733395
Current Application Domain Base Dir:C:/inetpub/wwwroot/AppTest/
Current Process Id:5044
Current Application Domain:/LM/W3SVC/1/ROOT/AppTest2-1-128701111868733395
Current Application Domain Base Dir:C:/inetpub/wwwroot/AppTest/
http://localhost/AppTest3/Default.aspx
Current Process Name:w3wp
Current Process Id:5044
Current Application Domain:/LM/W3SVC/1/ROOT/AppTest3-2-128701113026462030
Current Application Domain Base Dir:C:/inetpub/wwwroot/AppTest/
Current Process Id:5044
Current Application Domain:/LM/W3SVC/1/ROOT/AppTest3-2-128701113026462030
Current Application Domain Base Dir:C:/inetpub/wwwroot/AppTest/
Here is the conclusion:
IIS process is w3wp;
Every application pool in IIS use it's own process; AppPool1 uses process 3784, AppPool2 uses process 5044
Different applications in Asp.net will use different AppDomain;
AppTest2 and AppTest2 are in different AppDomain, but in the same process.
What's the point to use them?
Application pool and AppDomain , both of them can provide isolations, but use different approches. Application pool use the process to isolate the applications which works without .NET. But AppDomain is another isolation methods provided by .NET.
If your server host thousands of web sites, you wont use thousands of the application pool to isolate the web sites, just becuase, too many processes running will kill the os. However, sometime you need application pool. One of the advantages for application pool is that you can config the identity for application pool. Also you have more flexible options to recyle the application pool. At least right now, IIS didnt provide explicit options to recyle the appdomain.
- Application Pool 与 AppDomain 区别
- 应用程序池与应用程序域的区别(Different between Application Pool and AppDomain )
- C#中AppDomain.CurrentDomain.BaseDirectory与Application.StartupPath的区别
- C#中AppDomain.CurrentDomain.BaseDirectory与Application.StartupPath的区别
- AppDomain.CurrentDomain.BaseDirectory与Application.StartupPath的区别
- AppDomain.CurrentDomain.BaseDirectory与Application.StartupPath的区别
- C#中AppDomain.CurrentDomain.BaseDirectory与Application.StartupPath的区别
- C#中AppDomain.CurrentDomain.BaseDirectory与Application.StartupPath的区别
- C# APPDOMAIN.CURRENTDOMAIN.BASEDIRECTORY与APPLICATION.STARTUPPATH的区别
- C#中AppDomain.CurrentDomain.BaseDirectory与Application.StartupPath的区别
- C#中AppDomain.CurrentDomain.BaseDirectory与Application.StartupPath的区别
- C#中AppDomain.CurrentDomain.BaseDirectory与Application.StartupPath的区别
- C#中AppDomain.CurrentDomain.BaseDirectory与Application.StartupPath的区别
- AppDomain.CurrentDomain.BaseDirectory与Application.StartupPath的区别
- C#中AppDomain.CurrentDomain.BaseDirectory与Application.StartupPath的区别
- AppDomain.CurrentDomain.BaseDirectory与Application.StartupPath的区别
- C#中AppDomain.CurrentDomain.BaseDirectory与Application.StartupPath的区别
- 转载获取路径C#中AppDomain.CurrentDomain.BaseDirectory与Application.StartupPath的区别
- 数据库设计范式
- 纯忽悠程序员的开发要求(3):编写代码时要注意可扩展性!
- 抗锯齿原理与方法
- java对汉字的读取
- Android Layout之二:LinearLayout
- Application Pool 与 AppDomain 区别
- REPLACE
- org.apache.axis2.AxisFault: For input string:(Axis2)
- Coolite GridPanel 操作之一:获取gridpanel 选中行的记录信息
- 8/11
- 系统配置文件介绍
- 从远方赶回
- baidu hi在ubuntu上的安装(接近完美)
- arise your window step by step