开发者

Aspx file generation

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜