ASP.NET Global / Static Storage?

I have a thread safe object that is part of the API previously used in Windows service / client scripts. This thread-safe object is essentially singleton and stored in a static variable so that all callers can access the same state.

This API has recently started to be used in an ASP.NET application, and I suspect that some of the funky behavior we see may be due to unexpected AppDomain / lifecycle behavior. Therefore, I was interested to know if I can receive confirmation:

Is the static variable reliably available for all requests, or does ASP.NET do any tricking with multiple applications for multiple requests?

I understand that this will be the case for the web garden ... but our IIS is configured to use only one process and configured to reuse only once a day

+4
source share
1 answer

The static variable should be the same for all requests in 1 workflow. I would suggest you add the logs to your asp.net application, especially in application_start / stop and in the singleton static constructor, to find out what happens. Hope this helps.

+1
source

All Articles