Using II7 on Windows Server 2008.
DynamicPDF for .NET Enterprise Version 5.0.2.20
I am creating PDFs for a web customer. Unfortunately, the code is far too involved to post any working examples.
I create what we call a proposal using this method:
FileStream saveFile = new FileStream(filename, FileMode.Create, FileAccess.Write);
PDF.ProposalPDFOutoput(insuranceApplication).Draw(saveFile);
saveFile.Close();
Where PDF.ProposalPDFOutput returns a type of MergeDocument.
This code works fine the first time through. However, if I try and execute the code on a different page, within a short period of time from the first execution, I get an error (see below) that the file is in use.
Is this an II7 issue, a DynamicPDF issue? I used to use direct file access for all of this, but have since recoded all file IO to use FileStreams thinking that might be the issue. I am stumped and need a resolution quickly.
Greg
Exception: System.IO.IOException: The process cannot access the file 'D:\www\iacusa_php\www.virtual\PDFStore\IAC\PHP_SSL\Deluxe\007\Proposal_Deluxe.26469.pdf' because it is being used by another process.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access)
at IdeaStar.Insurance.IAC.PHP.PDF.storeProposalPDF(InsuranceApplication insuranceApplication) in D:\Projects\IAC\PHP\PHP_Production\Class Library\PDF.cs:line 2446
at UserControls_QuoteConfigurationDetails.linkbuttonApply_Click(Object sender, EventArgs e) in d:\www\iacusa_php\www\UserControls\QuoteConfigurationDetails.ascx.cs:line 859
at System.Web.UI.WebControls.LinkButton.OnClick(EventArgs e)
at System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
The process cannot access the file ERROR
Re: The process cannot access the file ERROR
Support · Jun 10, 2009Hello,
The DynamicPDF Merger product will releases all the resources and it does not hold on to the PDF. When using FileStream to load the PDF, there is nothing in our product that is locking the PDF.
We have not seen this behavior using our product. It could be a problem with IIS 7.
Thanks,
ceTe Software Support Team