One of my classes have static constructor that assigns new GUID to static variable. Then I use that variable for folder name that I create to store cached information for the lifetime of my website. The goal is to have different folder names when website is recycled or something else happens.
My website is running in IIS7 and is configured to have maximum one worker process. Recycling is disabled.
I use ThreadPool.QueueUserWorkItem to make multiple parallel database requests asynchronously and then ManualResetEvent.WaitOne() to merge those calls back to one thread. I use mentioned above folder to cache results of those requests.
My problem is that it appears that at some point I get 2 folders created and running at the same time. I understand that means that I get 2 AppDomains, not just one. I don't understand why do I get second AppDomain and what can I do to prevent it from happening.