Reputation: 1
I am working on an .aspx page.its to download a pdf that is generated in the aspx page. .but when hosted in Amazon cloud i am getting the message.
"The process cannot access the file because it is being used by another process". but on the subsequent invocation of the .aspx page i am getting the pdf . The pdf file is being generated.
Upvotes: 0
Views: 78
Reputation: 174
Asp.Net uses separeted threads for each request. Probably you use some shared resources to generate pdf and don't clean up them. Therefore parellel requests may fail.
Using
block (or calling Dispose()
directly) may help.
using (StreamReader reader = new StreamReader(@"C:\My Files\test.txt"))
{
..
}
Also make sure you don't open files with exclusive permissions like this:
FileStream fileStream = new FileStream("test.txt", FileMode.Open, FileAccess.ReadWrite, FileShare.None);
Upvotes: 1