ASP.NET - 生成后无法删除excel文件 [英] ASP.NET - cannot delete excel file after generation

查看:76
本文介绍了ASP.NET - 生成后无法删除excel文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经创建了Web应用程序,它生成excel文件(使用epplus应用程序)并将它们存储在本地驱动器上。 excel文件通过电子邮件发送给用户。

I have made web application where it generates excel file (using epplus applicaiton) and stores them on local drive. The excel files are sent to users by email.

我面临的问题是我无法删除最后一个excel文件。 (其他文件被删除)。它说它正在被另一个进程使用。我知道如何解决这个问题?

The problem which i am facing is that I cannot delete the last excel file. (Other files gets deleted). it says it is being used by another process. Any idea how can I solve this issue?

谢谢

推荐答案

高级别,听起来用于生成文件的代码没有关闭文件,因此生成文件的方式是将文件保持打开状态。没有看到你的代码,但建议学习如何处理用于生成
文件的对象,这并不多说。

High level, it sounds like the code used to generate the file has not closed the file so how you generated the file is leaving it open. Not much to say without seeing your code but would suggest learning how to dispose of the object(s) used to generate the file.


这篇关于ASP.NET - 生成后无法删除excel文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆