using Colin.Bowern;

Life ends with a semi-colon.

  Home  |   Contact  |   Syndication    |   Login
  22 Posts | 0 Stories | 2 Comments | 33 Trackbacks

News

Archives

Post Categories

Ever get the following error?

“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.”

And of course you don't want to spend all day going through the IIS MMC dialog boxes on a web server with a large number of applications.  I put together a script to dump the script mappings which will tell you what the site is configured to run by looking at the ISAPI filter path for your script maps:

    1 Option Explicit

    2 Dim WMIService, ApplicationPool, ApplicationPools, Applications, index, VirtualDirectorySettings, ApplicationName, ScriptMap

    3 Const ComputerName = "."

    4 Set WMIService = GetObject("winmgmts:{authenticationLevel=pktPrivacy}\\" & ComputerName & "\root\microsoftiisv2")

    5 Set ApplicationPools = WMIService.ExecQuery("Select * From IIsApplicationPool Where Name LIKE 'W3SVC/AppPools/%'")

    6 

    7 WScript.Echo "Application Pool Name" & vbTab & _

    8             "Application Name" & vbTab & _

    9             "Extension"  & vbTab & _

   10             "Processor"

   11 

   12 For Each ApplicationPool in ApplicationPools

   13     ApplicationPool.EnumAppsInPool Applications

   14     For index = 0 to UBound(Applications)

   15         ApplicationName = CleanApplicationName(Applications(index))

   16 

   17         On Error Resume Next

   18         Set VirtualDirectorySettings = WMIService.Get("IIsWebVirtualDirSetting='" + ApplicationName + "'")

   19         If Err.number = 0 Then

   20             For Each ScriptMap in VirtualDirectorySettings.ScriptMaps

   21                 WScript.Echo ApplicationPool.Name & vbTab & _

   22                             ApplicationName & vbTab & _

   23                             ScriptMap.Extensions & vbTab & _

   24                             ScriptMap.ScriptProcessor

   25             Next

   26         Else

   27             WScript.Echo ApplicationPool.Name & vbTab & _

   28                         ApplicationName & vbTab & _

   29                         "--" & vbTab & _

   30                         "Unable to locate application virtual directory."

   31         End If

   32         On Error GoTo 0

   33     Next

   34 Next

   35 

   36 ' Trims the leading /LM/ and trailing /

   37 Function CleanApplicationName(applicationName)

   38     Dim ReturnValue

   39 

   40     If Len(applicationName) < 5 Then

   41         Err.Raise 0, "CleanApplicationName", "applicationName should be greater than 5 characters."

   42     End If

   43 

   44     ReturnValue = Mid(applicationName, 5)

   45     ReturnValue = Mid(ReturnValue, 1, Len(ReturnValue) - 1)

   46 

   47     CleanApplicationName = ReturnValue

   48 End Function

The results can be opened in Excel and with the use of the handy Auto Filter feature you can narrow your scope and spot the problem in a lot less time than manually sniffing through.

W3SVC/AppPools/DefaultAppPool   W3SVC/1/ROOT    .aspx   C:\WINDOWS\Microsoft.NET
\Framework\v1.1.4322\aspnet_isapi.dll

posted on Monday, May 08, 2006 10:12 AM