IIS6列出正在运行的应用程序池的.net版本 [英] IIS6 List the version of .net an application pool is running

查看:136
本文介绍了IIS6列出正在运行的应用程序池的.net版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想枚举服务器上运行的应用程序池.在IIS7中,我可以通过WMI WIn32_Process提取.net版本,但IIS6中不存在.如何获取运行工作进程/应用程序池的.net版本?

I want to enumerate the application pools running on a server. In IIS7 i am able to pull up the .net version via WMI WIn32_Process but it is not there in IIS6. How can I get the version of .net that a worker process/application pool is running in?

例如:

DefaultAppPool v2.0.50727

DefaultAppPool v2.0.50727

在IIS6中,.net是在ASP.NET选项卡下的虚拟目录中设置的,而应用程序池是在Virtual Directory选项卡下设置的.仅供参考:我正在运行Windows 2003 SP2 IIS6.

In IIS6 .Net is set in the Virtual Directories under the ASP.NET tab and the Application Pool is setup under the Virtual Directory tab. FYI: I'm running Windows 2003 SP2 IIS6.

推荐答案

IIS6应用程序池的问题在于,与IIS7不同,它们不知道将哪个版本的.NET Framework加载到其中.

The problem with IIS6 Application Pools is that unlike IIS7 they have no knowledge of what version of the .NET Framework is being loaded into them.

IIS6 网站确定由站点或子应用程序的脚本映射所指向的ASP.NET版本将哪个.NET Framework运行时加载到池中.工作进程只会盲目加载映射到扩展名(或通配符映射中定义的任何内容)的必需ISAPI DLL.

IIS6 websites determine which .NET Framework runtime is loaded into a pool by the version of ASP.NET that is pointed to by a site or sub application's script maps. A worker process will just blindly load the requisite ISAPI DLL that is mapped to an extension (or whatever is defined in the wildcard mapping).

这种旧方法通常会引起很多麻烦,其中可能会将分配给同一池的两个不同站点配置为运行不同版本的ASP.NET,而您却臭名昭著:

This old method is often the cause of much grief where two different sites allocated to the same pool may be configured to run different versions of ASP.NET and you get the infamous:

...,并将以下事件记录到Windows应用程序日志中:

...and the following event is logged to the Windows Application Log:


Event Type: Error
Event Source:   ASP.NET 2.0.50727.0
Event Category: None
Event ID:   1062
Date:       12/01/2011
Time:       12:31:43
User:       N/A
Computer:   KK-DEBUG
Description:
It is not possible to run two different versions of ASP.NET in the same 
IIS process. Please use the IIS Administration Tool to reconfigure your
server to run the application in a separate process.

确定应用程序池配置为运行哪个.NET版本的唯一方法是遍历分配给该池的每个站点并检查原始脚本映射.

The only way to determine what .NET version an application pool is configured to run is to walk every site that is assigned that pool and check the raw scriptmaps.

唯一的问题是(例如)无论出于何种原因,您都有一个配置错误的站点(或子应用程序)不再使用,该站点被设置为使用其他版本的ASP.NET,例如:

The only problem with this is where (for example), for whatever reason, you have a misconfigured site (or sub application) that is no longer in use that is setup to use a different version of ASP.NET, e.g.:


Site                         .NET Version   Application Pool 
============================================================
WebSite1                     ASP.NET 4.0    AppPool1
WebSite2 (no longer used)    ASP.NET 2.0    AppPool1

在这种情况下,您必须确定哪个站点优先确定框架版本.

In this case you have to decide which site takes precedence to determine the framework version.

此PowerShell脚本可以帮助您确定每个池中正在使用的ASP.NET版本:

This PowerShell script might help you ascertain what ASP.NET version is being used in each pool:

# Walk sites
$allsites = ([adsi]"IIS://Localhost/W3SVC").children | where { $_.SchemaClassName -eq "IIsWebServer" }
$pools = @()

foreach($site in $allsites)
{
  $path = "IIS://Localhost/W3SVC/" + $site.Name + "/root"
  $siteRoot = [adsi]$path
  $sitePool = $siteRoot.AppPoolId

  $aspx = $siteRoot.ScriptMaps | where { $_.StartsWith(".aspx") }

  if( $aspx.Contains("v1.1")) {
    $runtime = "1.1"
  } elseif ($aspx.Contains("v2.0")) {
    $runtime = "2.0"
  } elseif( $aspx.Contains("v4.0")) {
    $runtime = "4.0"
  } else {
    $runtime = "Unknown"
  }

  $v =  @{AppPool = $siteRoot.AppPoolId; RunTime = $runtime; SiteId = $site.Name}
  $pools += $v
}

$pools | Sort-Object { $_.AppPool } | % { Write-Host $_.AppPool $_.SiteId $_.RunTime }

它只会遍历根目录的站点,而不会递归地遍历每个站点以标识子应用程序.

It only walks the sites at the root level and doesn't recursively walk into each one to identify sub applications.

这篇关于IIS6列出正在运行的应用程序池的.net版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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