WINDOWS/system32/LogFiles 正在使用。 我怎样才能发现哪个程序正在使用它? 如果是服务器,我该如何使用它?

发布于 2024-08-01 18:38:16 字数 266 浏览 11 评论 0原文

在 WINDOWS/system32/LogFiles 中打开文件

    using (StreamReader r = new StreamReader(fileName))

会生成异常“因为该文件正在被另一个进程使用”。 我怎样才能知道另一个进程是什么? 难道是服务器更新日志了? 如果是,我如何确保关联的计划任务也可以访问?

谢谢!

恐怕我没有在此服务器上安装程序的权限。

opening a file in WINDOWS/system32/LogFiles with

    using (StreamReader r = new StreamReader(fileName))

generates exception "because the file is in use by another process". How can I figure out what the other process is? Could it be the server updating the logs? If it is, how can I ensure that my associated scheduled task can also have access?

thanks!

I'm afraid I don't have the auth to install programs on this server.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

情话难免假 2024-08-08 18:38:16

就我个人而言,我更喜欢 ProcessExplorer 及其“查找句柄”功能。

您还可以尝试以共享模式打开文件:

using (FileStream fs = File.Open(fileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
using (StreamReader r = new StreamReader(fs))
    ... 

Personally, I prefer ProcessExplorer with its "Find Handle" functionality.

You could also try opening a file in a shared mode:

using (FileStream fs = File.Open(fileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
using (StreamReader r = new StreamReader(fs))
    ... 
怀里藏娇 2024-08-08 18:38:16

这是令人不安的老派,但我喜欢这个非常糟糕的实用程序,名为:wholockme
http://www.dr-hoiby.com/WhoLockMe/

它可以让您知道谁已锁定文件。

雅各布

This is disturbingly old school, but I love this really bad utility called: wholockme
http://www.dr-hoiby.com/WhoLockMe/

It lets you know who has files locked.

Jacob

孤芳又自赏 2024-08-08 18:38:16

如果您想找出谁打开了该文件,我最喜欢的应用程序是 SysInternals 的 Handle (http://technet.microsoft.com/en-us/sysinternals/bb896655.aspx)。 我知道您说过您无权安装应用程序,这只是您运行的单个可执行文件,如果您愿意,您可以从网络共享运行它。

我遇到了 SMTP 服务日志的 LogFiles 锁定问题,我的解决方案是将文件复制到另一个位置并从那里打开它。 可能适合你正在做的事情。

If you want to find out who has the file open, my favorite app for this is Handle by SysInternals (http://technet.microsoft.com/en-us/sysinternals/bb896655.aspx). I know you said you don't have authority to install apps, this is just a single executable that you run, and you could run it from a network share if you wanted.

I've had the LogFiles lock problem with SMTP service logs, my solution was just to copy the file to another location and open it from there. Might work for what you're doing.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文