How to resolve Retain in Memory and Unattended Execution problems in ActiveX controls that are running on IIS (833891)



The information in this article applies to:

  • Microsoft Internet Information Server 4.0
  • Microsoft Internet Information Services 5.0
  • Microsoft Internet Information Services version 5.1
  • Microsoft Internet Information Services version 6.0

We strongly recommend that all users upgrade to Microsoft Internet Information Services (IIS) version 6.0 running on Microsoft Windows Server 2003. IIS 6.0 significantly increases Web infrastructure security. For more information about IIS security-related topics, visit the following Microsoft Web site:

SUMMARY

This article helps Web server administrators and developers to discover and to resolve problems with miscompiled Microsoft Visual Basic 6.0 DLLs.

MORE INFORMATION

Microsoft Internet Information Services (IIS) is a multi-threaded process that requires special consideration when you develop and use Visual Basic 6.0 DLLs.

Two properties of Visual Basic 6.0, the Retain in Memory property and the Unattended Execution property, must both be set to True to run in IIS. Miscompiled Visual Basic DLLs are the Visual Basic DLLs that are compiled with the Retain in Memory property set to False, with the Unattended Execution property set to False, or with both properties set to False.

For additional information about the Retain in Memory property and the Unattended Execution property, click the following article number to view the article in the Microsoft Knowledge Base:

241896 PRB: Threading issues with Visual Basic 6.0 ActiveX components

Different symptoms may occur on your Web server if Visual Basic DLLs are miscompiled. For example, IIS may stop responding (hang), IIS may crash, or you may receive HTTP 500 error messages.

You can download and use the IIS Debug toolkit to determine if you have any loaded Visual Basic DLLs that are miscompiled. To download the IIS Debug toolkit, visit the following Microsoft Web site: To check these properties on your loaded Visual Basic DLLs, extract the toolkit files, and then run the following command on your Web server:

iisdump -s

This command generates a file that is named Sysinfo_datetimestamp.xml. Scan the file for information that resembles the following:
DLL Path="C:\INETPUB\WWWROOT\SIMPLE.DLL"
	Version="1.0.0.0"
	Timestamp="12/01/2004 15:08:42"
	UnattendedExecution="false"
	RetainInMemory="false"
If the Retain in Memory property is set to False or if the Unattended Execution property is set to False, the Visual Basic DLL is miscompiled.

If you have miscompiled Visual Basic DLLs, use one of the following methods to resolve the problem based on your version of IIS:

IIS 4.0

Make sure that the version of Msvbvm60.dll is 6.0.96.32 or later and that the file is dated June 21, 2002 or later. If you do not have this version or a later version of Msvbvm60.dll, you can update the Visual Basic runtime. To update the Visual Basic runtime, visit the following Microsoft Web site: Note Alternatively, you can recompile the Visual Basic DLL with both the Retain in Memory property set to True and the Unattended Execution property set to True.

IIS 5.0

Make sure that the version of MSvbvm60.dll is 6.0.96.32 or later and that the file is dated June 21, 2002 or later. To do this, use either of the following methods:
  • Install Microsoft Windows 2000 Server Service Pack 4 (SP4).

    For additional information about how to locate Windows Server Service Pack 4, click the following article number to view the article in the Microsoft Knowledge Base:

    260910 How to obtain the latest Windows 2000 service pack

  • Update the Visual Basic runtime. To update the Visual Basic runtime, visit the following Microsoft Web site:
Note Alternatively, you can recompile the Visual Basic DLL with both the Retain in Memory property set to True and the Unattended Execution property set to True.

IIS 5.1

Make sure that the version of Msvbvm60.dll is 6.0.96.32 or later and that the file is dated June 21, 2002 or later. If you do not have this version or a later version of Msvbvm60.dll, you can update the Visual Basic runtime. To update the Visual Basic runtime, visit the following Microsoft Web site: Note Alternatively, you can recompile the Visual Basic DLL with both the Retain in Memory property set to True and the Unattended Execution property set to True.

IIS 6.0

The server may be running in worker process isolation mode or in compatibility mode. If the server is running in worker process isolation mode, do either of the following:
  • Create a configuration file that is named W3wp.exe.cfg. Put this file in the following location:

    %windir%\system32\inetsrv

    The file must contain the following text:
    [Options]
    Unattended=1
    Retained=1
  • Make sure that custom Visual Basic DLLs and third-party Visual Basic DLLs that are compiled with either the Retain in Memory property set to False or the Unattended Execution property set to False are recompiled with both the Retain in Memory property set to True and the Unattended Execution property set to True.
If the server is running in IIS 5.0 compatibility mode, you can follow the instructions for IIS 5.0. Note, however, that you cannot install Windows 2000 Server SP4 on Microsoft Windows Server 2003.

Alternatively, you can recompile the Visual Basic DLL with both the Retain in Memory property set to True and the Unattended Execution property set to True.

REFERENCES

For additional information, click the following article numbers to view the articles in the Microsoft Knowledge Base:

264957 PRB: Visual Basic DLL has memory leaks and crashes in COM+ if 'Retain In Memory' is not set

307211 You can configure the Unattended Execution option and the Retained In Memory option in the latest version of Msvbvm60.dll

301237 HOWTO: Create a Visual Basic project template for creating IIS components

186273 BUG: AV running VB-built component in multi-threaded environment

243548 INFO: Design guidelines for VB components under ASP

191119 FIX: VB classes can cause IIS to have access violations


Modification Type:MinorLast Reviewed:6/23/2005
Keywords:kbhowto KB833891