繁体   English   中英

如何为用 Golang 编写的 windows 服务设置登录用户帐户?

[英]How to set a login user account for a windows service written in Golang?

I use the package "https://pkg.go.dev/github.com/kardianos/service" to run an application written in Go as a Windows service.

我在service.Config中设置了以下属性:

Username: "myusername"
Option: service.KeyValue{"password": "mypassword"}

当我然后安装程序时,我收到以下错误: The account name is invalid or does not exist, or the password is invalid for the account name specified.

我应该如何设置service.Config的属性以使服务在安装时使用指定的凭据正常运行?

我只是自己找到了解决方案。

Username:`DESKTOP-XXXXXX\myAcount`
Option: service.KeyValue{"password": "mypassword"}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM