HOWTO: Delete Web Service Extensions that cannot be normally Deleted

Question:

We installed ServletExec ISAPI for use with ESRI's ArcIMS map server software. We decided to go with Apache Tomcat servlet engine instead and uninstalled ServletExec. However, the Web Service Extension name "ServletExec" still exists, but the virtual directory it points to has been removed. We need to remove this extension, but cannot figure out how to do it. We have use the iisext /RmFile command, but nothing came of it.

We are running IIS on Windows Server 2003.

Any help you can provide would be appreciated.

Answer:

Actually, since the Web Service Extension is pointing to a non-existent file/directory, it does not hurt you and you can safely ignore it. You are basically talking about a bug in the ESRI ArcIMS Setup program which fails to remove the IIS configuration it added upon installation... so I am actually more concerned that you contact that vendor to give them an opportunity to fix their bug so that future customers won't be affected like you. Yes, I know that you are not using their software so you have no business with them, but from the perspective of improving everyone's software (remember, this is the same fundamentals that Open Source software like Apache Tomcat relies upon to improve - if users like you fail to report issues, you probably wouldn't have chosen Apache Tomcat at this point in time).

The reason that iisext /RmFile does not remove the Web Service Extension is probably because it was created as "read-only" and not deletable. There is a single line of code in iisext.vbs which simply silently ignores deleting "read-only" entries, hence you probably saw it as "nothing came of it" even when you gave the right syntax.

Now, I am telling you how to do what you want, but I must first warn you that it is not unsupported (remember, that is why the built-in tools are not allowing you to do this)... so please be careful. At least take precautions to back up metabase.xml after flushing any outstanding changes to disk prior to making any more edits.

There are a few of ways to work-around this:

  1. Manually edit metabase.xml to remove the Web Service Extension
  2. Manually edit metabase.xml to change the Web Service Extension to be deletable, then run iisext.vbs to delete it
  3. Change iisext.vbs to delete "read-only" Web Service Extensions

Whichever option you choose depends on what you are comfortable with. I personally prefer #3 because it is the least invasive, and I do not encourage manual editing of metabase.xml. XML is finicky in format so more things can go wrong than right.

Modification of metabase.xml by Removal

  1. NET STOP IISADMIN /Y

  2. Open %windir%\System32\inetsrv\metabase.xml with an editor like notepad (if on 64bit machine, make sure to do this with a 64bit editor because 32bit editor will be restricted from accessing the System32 directory under which metabase.xml resides) 

  3. Search for the word "WebSvcExtRestrictionList" (sans the quotes)

  4. Look through the list of items and locate the Web Service Extension you want to delete and remove that entire line. Be careful if it happens to be the first or last item on the list - you must preserve the leading/trailing quotes of the WebSvcExtRestrictionList attribute

  5. NET START W3SVC (and restart any other services that stopped with NET STOP IISADMIN /Y)

    Yes, I know there is Edit While Running that simplifies the first and last steps, but I do not like turning on more product features to perform product work-arounds. Remember you are trying to work-around something, so you want less, not more code of that "something" (in this case IIS) running. You can make your own judgement.

Modification of metabase.xml by Changing

  1. NET STOP IISADMIN /Y

  2. Open %windir%\System32\inetsrv\metabase.xml with an editor like notepad (if on 64bit machine, make sure to do this with a 64bit editor because 32bit editor will be restricted from accessing the System32 directory under which metabase.xml resides)

  3. Search for the word "WebSvcExtRestrictionList" (sans the quotes)

  4. Look through the list of items and locate the Web Service Extension you want to delete and change its "0" to a "1". For example, suppose I want to change ASP to be deletable. I would change the following:

     1,C:\WINDOWS\System32\inetsrv\asp.dll,0,ASP,Active Server Pages
    

    to:

     1,C:\WINDOWS\System32\inetsrv\asp.dll,1,ASP,Active Server Pages
    
  5. NET START W3SVC (and restart any other services that stopped with NET STOP IISADMIN /Y)

    Yes, I know there is Edit While Running that simplifies the first and last steps, but I do not like turning on more product features to perform product work-arounds. Remember you are trying to work-around something, so you want less, not more code of that "something" (in this case IIS) running. You can make your own judgement.

  6. Now run your iisext.vbs /RmFile command and it should succeed.

Modification of iisext.vbs

  1. You should search for the following block of code in %windir%\System32\iisext.vbs:

     For i=0 to UBOUND(restrictions)
        If UCASE(restrictions(i).FilePath) = UCASE(strAppName) Then
            If restrictions(i).Deletable = 1 Then
                WebSvcObj.DeleteExtensionFileRecord strAppName
                bDel = True
            End If
        End If
    Next
    
  2. And change it to this (note the single-quote added at the beginning of those two lines):

     For i=0 to UBOUND(restrictions)
        If UCASE(restrictions(i).FilePath) = UCASE(strAppName) Then
             'If restrictions(i).Deletable = 1 Then
                WebSvcObj.DeleteExtensionFileRecord strAppName
                bDel = True
             'End If
        End If
    Next
    
  3. All you did is change the script to delete the Web Service Extension regardless if it is "read only" or not. This should allow you to subsequently run your iisext.vbs /RmFile command to do what you wanted.

//David