Finding the source of "It is not possible to run two different versions of ASP.NET in the same IIS process"

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:

Option Explicit

Dim network
Set network = CreateObject("WScript.Network")

Dim wmiService
Set wmiService = GetObject("winmgmts:{authenticationLevel=pktPrivacy}\\" & _
    network.ComputerName & "\root\microsoftiisv2")

Dim applicationPools
Set applicationPools = WMIService.ExecQuery("Select * From IIsApplicationPool " & _
    "Where Name LIKE 'W3SVC/AppPools/%'")

WScript.Echo "Application Pool Name" & vbTab & "Application Name" & vbTab & _
    "Extension" & vbTab & "Processor"

Dim applicationPool
For Each applicationPool in applicationPools
    Dim applications
    applicationPool.EnumAppsInPool applications

    Dim index
    For index = 0 to UBound(applications)
        Dim applicationName
        applicationName = CleanAppName(applications(index))

        On Error Resume Next
        Dim virtualDirectorySetting
        Set virtualDirectorySetting = wmiService.Get("IIsWebVirtualDirSetting='" & _
            applicationName & "'")
        If Err.Number = 0 Then
            Dim scriptMap
            For Each scriptMap in virtualDirectorySetting.ScriptMaps
                WScript.Echo applicationPool.Name & vbTab & ApplicationName & _
                    vbTab & ScriptMap.Extensions & vbTab & _
                    ScriptMap.ScriptProcessor
            Next
        Else
            WScript.Echo ApplicationPool.Name & vbTab & ApplicationName & _
                vbTab & "--" & vbTab & _
                "Unable to locate application virtual directory."
        End If
        On Error GoTo 0
    Next
Next

' Trims the leading /LM/ and trailing /
Function CleanAppName(applicationName)
    If Len(applicationName) 

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

Comments Subscribe to Post Comments Feed

boyd said:

Aside from the fact that the CleanAppName function is missing from your script it is otherwise interesting. thanks

Have Your Say