Solved

Scripting.Dictionary in Application

Posted on 2001-08-01
10
297 Views
Last Modified: 2007-12-19
I'd like to create Scripting.Dictionary object in Application_OnStart() in order to get rid of endless calls to database for persistent enough information.
But it fails in accordance with MSDN docs and in fact.
Is there relaible way to create this object for Application?

TIA.
0
Comment
Question by:OMC2000
10 Comments
 
LVL 7

Expert Comment

by:John844
ID: 6341786
I would not even try to create this object an application level of scope.  You are begging for trouble if you do.

You might can store the contents of the recordsets in a multidimensional array using rs.getrows().

John
0
 
LVL 1

Expert Comment

by:pjtt
ID: 6341889
John844 is right. And this especially applies to the dictionary object, which good ol' Microsoft never quite got the threading model right for. That's one way to bring your server to its knees. Storing state information can be a pain sometimes, but there's a huge difference in performance between storing it in the database as opposed to an object in the application or multiple session variables.

Peter Tracey
Developer
http://www.25online.com/peter
0
 
LVL 2

Expert Comment

by:enkay022798
ID: 6342311
I disagree with not using Dictionery objects at the application level. We used it vastly in one of my previous projects and never ran into any serious problems.

FOr the threading model to work just go into the registry and set the threading model for the Dictionery object to "Both".

All the best !
0
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 
LVL 15

Author Comment

by:OMC2000
ID: 6344409
enkay, the replacement of the "Apartment" with "Both" enables Scripting.Dictionary on Session level, but I still can't create this object on Application level.
What've I missed?
0
 
LVL 15

Author Comment

by:OMC2000
ID: 6344566
enkay, the replacement of the "Apartment" with "Both" enables Scripting.Dictionary on Session level, but I still can't create this object on Application level.
What've I missed?
0
 
LVL 2

Expert Comment

by:enkay022798
ID: 6344824
>>but I still can't create this object on Application level.

There shouldnt be a problem... where are you creating the object... what happens when it fails ? Do you get an error of any kind ?
0
 
LVL 15

Author Comment

by:OMC2000
ID: 6344959
The following code in global.asa:

<SCRIPT LANGUAGE="JavaScript" RUNAT="Server">
...
function Application_OnStart() {
  var c = Server.CreateObject("Scripting.Dictionary");
  Application("eee") = c; // line 92
...
}
...
</SCRIPT>

causes the following error on the first call of any page:

"Application object error 'ASP 0197 : 80004005'

Disallowed object use

/DutchSite/global.asa, line 92

Cannot add object with apartment model behavior to the application intrinsic object.
"
0
 
LVL 2

Accepted Solution

by:
enkay022798 earned 100 total points
ID: 6344976
Have you rebooted after changing the registry entry ? If the model is Both then why are you getting an error saying it is apartment threaded ?

Microsoft is sometimes strange ... any change to registry should be followed by a reboot.
0
 
LVL 15

Author Comment

by:OMC2000
ID: 6345101
Thanks a lot, it really required reboot. I forgot that specific for IIS and other MS Stuff.
0
 
LVL 2

Expert Comment

by:enkay022798
ID: 6345534
Glad you got it working :)
0

Featured Post

ScreenConnect 6.0 Free Trial

Check out the updates in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI that improves session organization and overall user experience. See the enhancements for yourself!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Choose the older file FSO 6 48
Select2 jquery help 9 88
Why Bundles is not working on certain files - ASP MVC 3 51
Connection to multiple databases 13 19
Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question