RunAs user

93 views
Skip to first unread message

Radosław Osiński

unread,
Apr 3, 2023, 4:37:48 AM4/3/23
to topshelf-discuss
Hi team,

I am trying to run windows service with admin account.
Service is starting and works but ignore my RunAs user and start with localsystem account.
LogOn Settings on service properties are grey out and I cannot change it manually.
Do you have any suggestions why my user data are ignored?

Here is HostFactory configuration:
  var rc = HostFactory.Run(x =>                                  
            {
               
                x.Service<Worker>(() => new Worker(cts));
                x.RunAs("dl-comp\rauser22", "TestAgt876542#");
                x.SetStartTimeout(TimeSpan.FromSeconds(30));
                x.SetStopTimeout(TimeSpan.FromSeconds(30));
                x.SetDescription("TestAgent");                  
                x.SetDisplayName("TestAgent");                                
                x.SetServiceName("TestAgent");
                                       
            });              

Thanks for suggestions!
Radek
Reply all
Reply to author
Forward
0 new messages