How can I ensure that my ASP.NET application is sharing only one instance of a DLL?
I have a DLL that runs the back-end and DB connections for a website that involves interactivity between individual sessions from seperate clients - 开发者_如何学运维i.e. chat etc.
The problem is, if 1000 people are browsing this website, I want all the various instances of my ASP.NET application sharing a single instance of this DLL - so I can manage all of the incoming and outgoing information in a single place.
How can I specify that only one instance of my back-end DLL should be used for the entire website, regardless of the number of clients who are connected?
Well, if your assembly is added to the GAC you're only using one DLL. And if you only want one instance running than it's called a "singleton" design pattern.
Try using multithreaded singleton pattern
http://msdn.microsoft.com/en-us/library/ff650316.aspx
精彩评论