英文:
How to set a login user account for a windows service written in Golang?
问题
我使用包"https://pkg.go.dev/github.com/kardianos/service"将一个用Go编写的应用程序作为Windows服务运行。
我在service.Config
中设置了以下属性:
Username: "myusername"
Option: service.KeyValue{"password": "mypassword"}
当我安装程序时,我收到以下错误消息:"帐户名无效或不存在,或者密码对于指定的帐户名无效。"
我应该如何设置service.Config
的属性,以便在安装时使用指定的凭据正确运行服务?
英文:
I use the package "https://pkg.go.dev/github.com/kardianos/service" to run an application written in Go as a Windows service.
I set the following attributes in service.Config
:
Username: "myusername"
Option: service.KeyValue{"password": "mypassword"}
When I then install the program, I get the following error: The account name is invalid or does not exist, or the password is invalid for the account name specified.
How should I set attributes of service.Config
to make the service run properly with specified the credentials when installed?
答案1
得分: 0
我刚刚自己找到了解决方案。
用户名:`DESKTOP-XXXXXX\myAcount`
选项:service.KeyValue{"password": "mypassword"}
英文:
I just found out the solution myself.
Username:`DESKTOP-XXXXXX\myAcount`
Option: service.KeyValue{"password": "mypassword"}
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论