在主机文件中使用本地主机别名时,服务控制管理器 (sc.exe) 失败,但直接使用环回地址时成功

发布于 2025-01-12 23:32:21 字数 426 浏览 5 评论 0原文

我正在运行命令:

sc \\My-Server create TestService binPath= "C:\Test\Test.exe"

但是,它失败了,

[SC] OpenSCManager FAILED 5:

Access is denied.

我的主机文件包含:

127.0.0.1 My-Server

但是,如果我执行下面的命令,它就可以正常工作!

sc \\127.0.0.1 create TestService binPath= "C:\Test\Test.exe"
[SC] CreateService SUCCESS

我以管理员身份运行cmd。有什么想法吗?

I am running the command:

sc \\My-Server create TestService binPath= "C:\Test\Test.exe"

However, it fails with

[SC] OpenSCManager FAILED 5:

Access is denied.

My hosts file contains:

127.0.0.1 My-Server

However, if I do the command below, it works just fine!

sc \\127.0.0.1 create TestService binPath= "C:\Test\Test.exe"
[SC] CreateService SUCCESS

I am running cmd as admin. Any ideas?

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

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

发布评论

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

评论(1

何其悲哀 2025-01-19 23:32:21

已解决。我找到了这个线程: https://serverfault .com/questions/184098/why-cant-i-access-an-administrative-share-on-my-local-machine

步骤 2:“允许服务器计算机与其自身使用文件共享通过 DNS 别名 (BackConnectionHostNames)” 为我解决了这个问题。我在 HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa\MSV1_0 中添加了一个名为 BackConnectionHostNames 的多字符串值,并为其指定了 My-Server 值>。再次运行 sc 命令,它起作用了。

Resolved. I found this thread: https://serverfault.com/questions/184098/why-cant-i-access-an-administrative-share-on-my-local-machine

Step 2: "Allowing server machine to use filesharing with itself via the DNS Alias (BackConnectionHostNames)" is what fixed it for me. I added a multi-string value called BackConnectionHostNames in HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa\MSV1_0 and gave it a value of My-Server. Ran the sc command again, and it worked.

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