Hi everyone
we are writing logs to a .txt file for a web application, using our own class. What the class does is create a semaphore with maximum maximum no. of current entries as 1. we use this semaphore to gain write access to the log file. like this....
private static Semaphore _ExceptionFileLock = new Semaphore(1, 1);
try
{
_ExceptionFileLock.WaitOne();
......
Open the file strea, write, and close....
......
}
catch (Exception objException)
{
throw objException;
}
finally
{
_ExceptionFileLock.Release();
}
Now what I'd like to know is once we publish it on IIS and multiple users hit this application, will IIS create a global semaphore for this or for different requests will IIS create different semaphore objects resulting in exception "file is alrady in use"
Any light on semaphore with reference to IIS will be greatly appreciated.
Thanks and regards
Pawan