locking question

  • Thread starter Thread starter szabelin
  • Start date Start date
S

szabelin

Do all asp threads servicing requests run as part of same
app domain? I need a lock at the scope of my web-app; is
the code below a correct way to syncronize blocks of code
in asp.net. Will this work if load balancer (multiple
servers) are used? Thanks!

lock(typeof(string))
{}

or

lock(Singleton.Instance)
{}
 
Short answer, no. Your web farm will not sync on sections of code. Using
lock() will work within critical sections of code to assure that
simultaneous page requests (aspnet threads) do not access that block at the
same time.


Charlie Nilsson [msft]
Visual Studio Update

--

This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm

Note: For the benefit of the community-at-large, all responses to this
message are best directed to the newsgroup/thread from which they
originated.
--------------------
 
Back
Top