views:

31

answers:

1

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

This API has recently started being used in an ASP.NET application, and I suspect that some funky behavior we're seeing may be due to unexpected AppDomain/lifecycle behavior. So I was wondering if I could get some verification:

Is a static variable reliably available for all requests, or does ASP.NET do any trickery with having multiple AppDomains for multiple requests?

I understand this would be the case for a web garden ... but our IIS is configured to use only 1 process, and is configured to only recycle once a day

+1  A: 

Static variable should be the same for all requests in 1 worker process. I would suggest you to add logs to your asp.net application, especially in application_start/stop and in static constructor of a singleton to see what's happening. Hope this helps.

Kirill Muzykov
Ok, this is what I thought but wanted to double verify my assumption. Thanks!
Joel Martinez