开发者

Aspx file generation

开发者 https://www.devze.com 2023-03-26 20:01 出处:网络
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.

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.


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);
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号