Problems with the application pool - probably
I suspect that your one-time object is not associated with the request, but rather with a wide range of applications (it can be created for each request, but can use some common resources). While you are testing your application in a development environment, it seems to behave as expected, but as soon as you put it into production, you get problems. This means that you may have problems with the application pool .
The IIS web application pool capabilities actually create multiple HttpApplication instances for your application, and all of them can share one-time shared resources. If this is the case with your one-time object and you share it, it may be that it is not thread safe. The same can be said about the fact that you will not use shared access to resources in thread-safe operations.
So, it may happen that while one request is executed, another begins, and the first deletes the object while the second process still uses it.
Additional information is always helpful.
If you explain the nature of your one-time object / resource and how you use it in your application, we could help you much better. But at the same time, you can read my blog post , which talks about application pools and their processing. This does not apply to disposable items per se, but you can still find all the useful and useful information.
source share