kardianos / service

Run go programs as a service on major platforms.
zlib License
4.44k stars 677 forks source link

why windows service start is error 1053 #280

Open zhouhaoJOKER opened 3 years ago

zhouhaoJOKER commented 3 years ago

my service have a "json config" file eg: appsetting.json. but my service is installed in D://myservicefolder/ so i start windows service is error 1053 error

so must config file in c:/windows/system32

kardianos commented 3 years ago

In windows, services don't have a configurable working directory (always system32). so you need to use "os.Executable" to get the current executable path, then join to the application config.

On Tue, Jun 29, 2021 at 10:47 AM zhouhao @.***> wrote:

my service have a "json config" file eg: appsetting.json. but my service is installed in D://myservicefolder/ so i start windows service is error 1053 error

so must config file in c:/windows/system32

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/kardianos/service/issues/280, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAFYLMPRR73N7COF6NI4AIDTVHTKFANCNFSM47QNZS4Q .

zhouhaoJOKER commented 3 years ago

Tks,I have a try, tks...

获取 Outlook for iOShttps://aka.ms/o0ukef


发件人: Daniel Theophanes @.> 发送时间: Tuesday, June 29, 2021 11:53:37 PM 收件人: kardianos/service @.> 抄送: zhouhao @.>; Author @.> 主题: Re: [kardianos/service] why windows service start is error 1053 (#280)

In windows, services don't have a configurable working directory (always system32). so you need to use "os.Executable" to get the current executable path, then join to the application config.

On Tue, Jun 29, 2021 at 10:47 AM zhouhao @.***> wrote:

my service have a "json config" file eg: appsetting.json. but my service is installed in D://myservicefolder/ so i start windows service is error 1053 error

so must config file in c:/windows/system32

― You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/kardianos/service/issues/280, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAFYLMPRR73N7COF6NI4AIDTVHTKFANCNFSM47QNZS4Q .

― You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/kardianos/service/issues/280#issuecomment-870718436, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AH56OJVQENPYHAUXWR6HP7TTVHUADANCNFSM47QNZS4Q.