简体   繁体   English

阅读后关闭app.config文件

[英]Close the app.config file after reading

My "app" is being hijacked by a monitoring service. 我的“应用”被监视服务劫持了。 After it dies, for some reason the app.config file is considered still in use, so I can't make changes. 它死后,由于某种原因,认为app.config文件仍在使用中,因此我无法进行更改。

The only thing I can do is rename the existing file, and save a new file with the old name. 我唯一能做的就是重命名现有文件,并用旧名称保存一个新文件。

This is not an interactive app, so I want to simply want to use notepad to make changes in the file between runs. 这不是一个交互式应用程序,因此我只想使用记事本在两次运行之间更改文件。

Here is what I would try: 这是我会尝试的方法:

  • Use Unlocker to figure out what service or process holds a handle to your file and "unlock" it 使用Unlocker找出哪些服务或进程持有文件的句柄并对其进行“解锁”
  • Try ProcessExplorer . 试试ProcessExplorer In menu go to Find > Find handle or DLL , search for your .config file and figure out what process is "taking a lock" on the file 在菜单中,转到查找>查找句柄或DLL ,搜索您的.config文件,然后找出该文件正在“锁定”的进程

Once you figure out what's causing this, check if you can somehow add an exception for your file, so that it's not trying to open this config file - very unlikely but an AV process may do that. 一旦弄清是什么原因造成的,请检查是否可以以某种方式为文件添加例外,以便它不会尝试打开此配置文件-不太可能,但AV进程可以这样做。 Other solutions is to kill a misbehaving 3rd party app and start it once you finished editing config file. 其他解决方案是杀死行为异常的第三方应用程序,并在完成配置文件编辑后立即启动它。

Double check that your app was actually killed and no longer runs. 仔细检查您的应用程序实际上已被杀死并且不再运行。 Use process explorer or default task manager (or any other similar tool on non-Windows OS). 使用流程浏览器或默认任务管理器(或非Windows OS上的任何其他类似工具)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM