我正在开发一个 ASP.NET MVC3 项目,我的项目的一部分是打印 PDF 文件。System.Net.Mail
直到今天早上,当我添加发送附件时,一切都很好。而且,在此之后也可以正常工作,但是当我尝试编辑信息时,出现此错误:
The process cannot access the file 'Content\StudentPdf\student54.pdf' because it is being used by another process.
我iTextSharp
用来打印 PDF,但它在下一行代码崩溃:
using (FileStream fs = new FileStream(Server.MapPath("~/Content/StudentPdf/student" + id + ".pdf"), FileMode.Create))
如何找出我的文件在我的解决方案中的使用位置?我PrintPdf
的方法在方法之前被调用SendEmail
。