在主机文件中使用本地主机别名时,服务控制管理器 (sc.exe) 失败,但直接使用环回地址时成功
我正在运行命令:
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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
已解决。我找到了这个线程: 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
inHKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa\MSV1_0
and gave it a value ofMy-Server
. Ran thesc
command again, and it worked.