PRB: Scripting.Dictionary Object Fails in ASP Application Scope

ID: Q194803


The information in this article applies to:


SYMPTOMS

When storing the Scripting.Dictionary object in an Application variable the following error occurs:

Application object error 'ASP 0197 : 80004005'
Disallowed object use /xxx.asp, line 2. Cannot add object with apartment model behavior to the application intrinsic object.


CAUSE

The Dictionary object's threading model is incorrectly set to "Both" in the registry when Internet Information Server (IIS) 4.0 is initially installed. This is documented in the IIS documentation, which also includes instructions to update the ThreadingModel registry key. When Visual Studio 6.0 is installed it updates/corrects the threading model of the Dictionary object, setting it to "Apartment."


RESOLUTION

To work around this problem, create all global Scripting.Dictionary objects with a session scope as follows:


   <%Set Session("SD")= Server.CreateObject("Scripting.Dictionary")%> 


STATUS

This behavior is by design.


REFERENCES

Please refer to the following Windows NT 4.0 Option Pack Product Documentation for Scope and Threading guidelines:


   Microsoft Internet Information Server

      Programmers Reference
         Creating Components for ASP
            Planning for Component Development
               Component Design Guidelines 

Please refer to the following Windows NT 4.0 Option Pack Release Notes for information on the Scripting.Dictionary object registry key:

   Internet Information Server Version 4.0 Release Notes 


Keywords          : kbASPObj kbVisID600 kbGrpASP 
Version           : WINDOWS:6.0
Platform          : WINDOWS 
Issue type        : kbprb 

Last Reviewed: May 4, 1999