IIS 7 Locking a PDF file
Posted on 2011-09-08
Server: Windows 2008 R2 with IIS 7
This server contains a .NET web page and performs the following actions in one of it's pages:
1. Create a PDF file.
2. Email it to the a specific address
3. Delete the PDF file.
During this process, we receive the following error:
The process cannot access the file 'C:\inetpub\wwwroot\admin\output\Invoice-100127-20110908.pdf' because it is being used by another process.
It is failing on STEP 3 because the PDF is created and the email is being sent.
We are currently interested in finding out if there is a setting within IIS that can be changed to alleviate this, or any other solution to this issue whether it be in IIS or the code-behind on the page.
Any assistance would be greatly appreciated.