如何应对异常"System.IO.IOException:该进程无法访问文件'C:\ ... \ file.xxx',因为该文件正被另一个进程使用."? [英] How to cope with exception "System.IO.IOException: The process cannot access the file 'C:\...\file.xxx' because it is being used by another process."?

查看:745
本文介绍了如何应对异常"System.IO.IOException:该进程无法访问文件'C:\ ... \ file.xxx',因为该文件正被另一个进程使用."?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在实际执行环境中,我随便捕获了一个异常

In real execution environment, I casually catch an exception

用代码表示.

仅在Win 2012中出现此问题.Win 08 R2可以.显然,此文件已被其他未知进程锁定,但是我无法在我的开发环境中重现此问题.必须用代码解决此问题,因为我无法手动关闭其他进程或程序.有什么措施 杀死这个未知的进程或其他方法让我可以运行通过?

This issue only occured in Win 2012. Win 08 R2 is ok. Obviously, this file is locked by other unknown process, but I can't reproduce this issue in my dev env. This issue must be coped in code for I can't manual close other process or program. Have any measures to kill this unknown process or other methods let me can run pass?

此致

Kaneabell

Kaneabell

推荐答案

您不知道谁使用文件的过程吗?

您确定不是您的应用程序在使用该文件吗?

使用后您是否关闭文件?

Do you have  no idea of the process who use your file?

Are you sure that is not your application who use the file?

Do you close your file after used?

您能解释一下如何使用该文件吗?

Could you explain how do you use the file ?

此致

MyWin8


这篇关于如何应对异常"System.IO.IOException:该进程无法访问文件'C:\ ... \ file.xxx',因为该文件正被另一个进程使用."?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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