0

in my solution i have a console project reg to start my app and it works fine

now i want to Replace console to a windows service Service1 but it doesn't work and give me an error to connect with database

this is my solution and i use Service1 item instead Console reg

enter image description here

and this is my onStart Method

      protected override void OnStart(string[] args)
      {
            System.Diagnostics.Debugger.Launch();
                 EventLog.WriteEntry("Service Started...");
                 ConfigureServer();
      }

Here, the problem occurs cannot run database xds requested by the login

 using (System.Management.Automation.PowerShell powershell = System.Management.Automation.PowerShell.Create())
                     {
                          powershell.Runspace = myRunSpace;
                          powershell.Commands.AddScript("Get-CsTrustedApplicationPool");
                          Collection<PSObject> results = null;
                          Collection<ErrorRecord> errors = null;
                          try
                          {
                                results = powershell.Invoke();
                                errors = powershell.Streams.Error.ReadAll();
                          }
Tarek Saied
  • 6,482
  • 20
  • 67
  • 111

1 Answers1

1

On which account your service is running?

enter image description here

Anuraj
  • 18,859
  • 7
  • 53
  • 79