VBScripting Dictionary Not Safe to Use in IIS Application Scope (240415)



The information in this article applies to:

  • Microsoft Site Server 3.0 Commerce Edition

This article was previously published under Q240415

SYMPTOMS

The VBScripting Dictionary is contained in Vbscript.dll and Scrrun.dll. Data corruption and Access Violation errors can occur when the dictionary is used in an application scope in Internet Information Server (IIS).

CAUSE

The VBScriting Dictionary is designed to be apartment threaded. IIS is a multithreaded environment. Marking it as apartment threaded (rather than BOTH), forces COM to create the object in an STA thread and serialize access. The problem with the dictionary is due to race conditions that arise from multithreaded access. Therefore, the dictionary does not work correctly in an application scope in IIS.

RESOLUTION

When you using Site Server Commerce Edition, you should use the Commerce Dictionary. This dictionary is designed for the multithreaded IIS environment. Commerce.dictionary provides persistence and For..Next enumeration, which leads to a cleaner code.

MORE INFORMATION

When version 3.1 of the scripting engine shipped, the registry for the scripting dictionary was marked incorrectly on install as BOTH threaded, instead of apartment. This allowed you to use it in the application scope without an error message, but corrupted data.

This problem is documented in the IIS Release Notes. It describes how to correct the registry. It also indicates that apartment threaded objects should not be used in an application scope.

Modification Type:MajorLast Reviewed:6/30/2004
Keywords:kbprb KB240415