从directoryinfo中删除文件的问题,,,帮助我 [英] problem in deleting file from directoryinfo ,,,, help me out

查看:113
本文介绍了从directoryinfo中删除文件的问题,,,帮助我的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何从asp.net中的服务器文件夹中删除文件,我收到错误,该文件被另一个进程使用,我怎么能阻止它

how can i delete files from server folder in asp.net , i am get error that file is used by another process , how can i stop it

推荐答案

请查看我过去的答案:

使用的文件另一个流程异常 [ ^ ],

如何压缩错误'它已经被vb.net中的另一个进程使用了​​ [ ^ ]。



-SA
Please see my past answers:
File used by another process exception[^],
how to compress the error 'it is already used by another process' in vb.net[^].

—SA


As richcb建议,确保你关闭你的读者/作家完成工作后我们的代码。也就是说,如果您处于在代码中关闭文件并且需要将其发布为时已晚的情况,您可以重新启动IIS服务或结束工作进程以获取文件,然后您应该能够删除它。
As richcb suggested, make sure you close your readers/writers in your code when you are done working with them. That said, if you are in a situation where it's too late to close the file in code and you need to get it released, you can restart your IIS service or end your worker processes to get the file released and then you should be able to delete it.


这篇关于从directoryinfo中删除文件的问题,,,帮助我的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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