确定哪个进程对文件有锁定 [英] Determining what process has a lock on a file

查看:129
本文介绍了确定哪个进程对文件有锁定的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个在本地正常工作的单元测试,但上传到TeamCity构建服务器时失败,进程无法访问该文件,因为它正在被另一个进程使用。




  • 在我做任何测试
    之前,如果文件
    存在,请检查设置,如果是的话尝试删除它。
    此错误与上述相同的错误
    消息

  • 当读取
    文件时,关闭写入器,然后处理
    我相信应
    摆脱任何资源。


    所以我有几个查询


    1. 有没有人有类似的问题,并设法绕过他们

    2. 如何找出programticall
      进程已经被自私锁定
      文件!!!

      $ b $干杯

      解决方案

      Sysinternals FileMon 有一些信息(向下滚动)如何在较旧的Windows版本中完成此操作。



      进程监视器是他们的最新版本,但是并没有给出很多线索。有一些知识库文章链接在那里,但是,应该引导你这个信息。



      -Adam


      I have a unit test that works fine locally but when uploaded to TeamCity build server fails with "The process cannot access the file because it is being used by another process."

      1. Before I do anything in the Test I check in the setup if the file exists and if so try to delete it. This fails with the same error message as above
      2. When wriitng the file, I close the writer then dispose of it which I believe should get rid of any resources.

      So I have a couple queries

      1. Has anyone had similar issues and manage to get around them
      2. How can find out programticall what process has selfishly locked the file!!!

      Cheers

      解决方案

      Sysinternals FileMon has some information (scroll down) on how they accomplished this in older windows versions.

      Process monitor is their latest version, but it doesn't give many clues as to how they do it. There are some knowledge base articles linked there, though, that should lead you to this information.

      -Adam

      这篇关于确定哪个进程对文件有锁定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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