Microsoft KB Archive/246111

{|
 * width="100%"|

BUG: AppUnload Does Not Unload Application

 * }

Q246111

-

The information in this article applies to:


 * Microsoft Windows NT Server version 4.0
 * Microsoft Windows NT Workstation version 4.0
 * Microsoft Internet Information Server 4.0

-

SYMPTOMS
Executing the AppUnload method on a loaded Internet Information Server (IIS) application may not unload the application from memory.

CAUSE
IIS is executing a string-sensitive search in order to locate the application to unload.

RESOLUTION
To resolve this problem, connect to the application by passing the following string to GetObject. Make sure that the case of the string passed is not changed.

 Dim DirObj Set DirObj = GetObject("IIS://LocalHost/W3SVC/1/Root/SomeApp") DirObj.AppUnload "SomeApp" should be replaced with the name of the application you wish to unload as you see it in the Internet Service Manager.

STATUS
Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article.

MORE INFORMATION
To reproduce this behavior, use the Internet Service Manager and set an application in IIS to Run in a separate memory space. When you access an ASP page in this application for the first time, a new Mtx.exe process will appear in Task Manager. Select Unload from the properties of the application in the Internet Service Manager (don't leave the property sheet open between operations). The Mtx.exe process disappears from Task Manager. The application is unloaded at this point, so in order to test the unloading code, you must reload the application. You can reload the application by hitting an ASP page in the application. Next, try to unload the application by using the following code:

 Dim DirObj Set DirObj = GetObject("IIS://LocalHost/W3SVC/1/ROOT/SomeApp") DirObj.AppUnload You will see that the Mtx.exe process is not unloaded. Changing "Root" to "ROOT" broke the code.

NOTE: This solution will not work unless the application resides in a virtual directory. To convert a logical directory to a virtual directory, use the following steps:


 * 1) Using Internet Service Manager, change the application to run in-process. (Clear the Run in separate memory space option.)
 * 2) Using the MetaEdit tool (which is part of the IIS Resource Kit), add the following keys:
 * 3) Using Internet Service Manager, change the application to run out-of-process. (Select Run in separate memory space.)

The application will be then be running out of a virtual directory and the code will successfully unload the application.

NOTE: This problem does not occur with Internet Information Services 5.0.