Consider all .NET application-wide primitives like Mutex
, WaitHandles
and so on. Their characteristic is to be set using a Name which is used to reference to a common object in the system (for example two mutexes having the same name in two different applications refer to the same mutex).
Well, this behavior is very useful.
Is it available on web applications too?
I mean: I manage common resources on a web application. When more calls to a web page are made, given that these pages use the same resource, a file, they should use a common mutex to guard this important resource. Can I use Mutex using a given name, being 开发者_如何学Gocertain that that mutex will work as I expect?
The .NET platform is consistent. Everything that works for a console application works for a web application and a Windows Service and anything else.
The only differences are those inherent in the different environments: the Windows Service and ASP.NET Web Application are not desktop applications, and so they are running under a service account of some kind, and without a message pump. The ASP.NET application is probably running in a reduced trust environment, so certain APIs won't work.
But in general, everything works everywhere.
精彩评论