锁定远程计算机(Windows)上的文件的简单方法?

发布于 2024-09-04 10:41:15 字数 483 浏览 3 评论 0原文

我已经在日志中找到了一个错误,并正在尝试重现它。我的理论是,文件有时会被锁定在特定文件夹中,当应用程序 (ASP.NET) 尝试删除该文件夹时,它会挂起。

我没有在自己的计算机上运行该应用程序,因此我在远程服务器上对其进行调试。但在我的一生中,我似乎无法找到一种方法来锁定文件以防止该文件被进程删除。

我的第一个想法是将网络路径映射到本地驱动器,然后让命令提示符对该文件夹保持打开状态。在本地,这总是会弄乱我的文件夹删除,但显然 SMB 更强大,并且不会授予我锁定。

之后我在文件夹中创建了一个无限循环vbscript并远程执行它。该文件已从执行代码下方删除。男人!

然后我尝试在服务器上的该文件夹中创建一个文件并删除所有权限。那并没有达到目的。我无权访问 IIS 设置,因此它可能在特权系统帐户下运行。

那么:您知道有什么程序是免费的,我可以快速使用它在文件上创建独占锁,以便我可以测试我的删除理论?就像一个非常非常糟糕的记事本克隆或其他东西。

:-)

I've tracked down an error in my logs, and am trying to reproduce it. My theory is that a file sometimes gets locked in a specific folder, and when the application (ASP.NET) tries to delete that folder it hangs.

I don't have the application running on my own machine so I'm debugging this on a remote server. But for the life of me, I can't seem to figure out a way to lock a file that prevents it from being deleted by the process.

My first thought was to map the network path to a local drive and just leave a command prompt open to that folder. Locally that always fouls up my folder deletes, but apparently SMB is a bit more robust and doesn't grant me a lock.

After that I created an infinte loop vbscript in the folder and executed it remotely. The file was deleted out from underneath the executing code. Man!

I then tried creating a file on the server in that folder and removing all permissions. That didn't do the trick. I don't have access to the IIS settings so perhaps it's running under a privileged system account.

So: what's a program that you know is free and I can quickly use to create an exclusive lock on a file so I can test my delete theory? Like a really, really bad Notepad clone or something.

:-)

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

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

发布评论

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

评论(1

浅忆流年 2024-09-11 10:41:15

您不能只从网络文件夹创建一个文本文件并使用 MS Word/VS 或在编辑过程中锁定它的类似程序打开它吗?

Can't you just create a text file from a network folder and open it with MS Word/VS or a similar program which locks it during editing?

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