You'll need execute the Dispose method instead of close.
Hi
Thanks for your response.
Below is a code snipet from one of my webservice methods:
string fName = Path.Combine(path, "schemaDate.dat");
lock(m_syncToken) {
StreamWriter sw = File.CreateText(fName);
try{
sw.Write(m_schemaDate.ToString(CultureInfo.InvariantCulture));
}
finally{
sw.Close();
}
}
m_syncToken is defined as:
private static object m_syncToken;
My question is: is this pattern powerful enough to ensure exclusive
acces to only one request? I'm using .NET Framework 1.1 and IIS 5.1.
Mariano Omar Rodriguez a scris:
> You'll need execute the Dispose method instead of close.
>
[quoted text clipped - 9 lines]
> > Thanks.
> > Adi.
Mariano Omar Rodriguez - 24 Jan 2007 00:00 GMT
This code only assures single access to the file if only a worker process is
running at the time.
Ahother thing is that you need call Dispose instead of Close.
> Hi
>
[quoted text clipped - 32 lines]
>> > Thanks.
>> > Adi.
nano2k - 24 Jan 2007 06:47 GMT
Dispose method of what object?
Mariano Omar Rodriguez a scris:
> This code only assures single access to the file if only a worker process is
> running at the time.
[quoted text clipped - 36 lines]
> >> > Thanks.
> >> > Adi.