我有一个诊断网页,我需要确保该网站以编程方式在 ASP.NET 中安装在正确的应用程序池版本上。
我在 Windows 7 下运行 IIS 7.5,但代码也必须在 Windows Server 2008 R2 下运行。
我知道如何通过以下两种方式获取 App Pool 名称:
// First way to do it
string name = System.Environment.GetEnvironmentVariable("APP_POOL_ID", System.EnvironmentVariableTarget.Process);
// Second way to do it
string name = HttpContext.Current.Request.ServerVariables["APP_POOL_ID"];
但是,从那里,我不知道如何获得 App Pool 版本。我查看了很多网页和论坛,但我找不到答案。任何人都可以帮忙吗?