I had a webservice that reads .txt files using StreamReader and sends back responses to the user. If multiple people call my webservice, will the .txt files be "locked" and thus only be able to handle processing one request at a time?
Thanks.
I had a webservice that reads .txt files using StreamReader and sends back responses to the user. If multiple people call my webservice, will the .txt files be "locked" and thus only be able to handle processing one request at a time?
Thanks.
I think this depends. Are any changes being made to the text file? If not, then the file should not be locked, because once it is opened, it should be read into the stream using a stremreader object, and then closed. Refer to
How do I open an already opened file with a .net StreamReader?
and
http://msdn.microsoft.com/en-us/library/db5x7c0d.aspx
This code creates a StreamReader that points to MyFile.txt through a call to File.OpenText. StreamReader.ReadLine returns each line as a string. When there are no more characters to read, a message is displayed to that effect, and the stream is closed.