Microsoft KB Archive/240415

= VBScripting Dictionary Not Safe to Use in IIS Application Scope =

Article ID: 240415

Article Last Modified on 6/30/2004

-

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.

Keywords: kbprb KB240415

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.