claudegia
claudegia

Reputation: 21

.NET 6.0 application fails to use COM object when launched from Windows service after user logs out

I'm developing an application in .NET 6.0 that needs to use a COM object (which is a strict requirement). I now need to schedule and launch this application through a job scheduling service.

I considered creating a Windows service to handle the job because it provides useful features like automatically restarting the service if it crashes, ensuring better business continuity.

However, I encountered an issue: when the application is launched by the service using Process.Start(), it fails to access the COM object due to authorization issues.

Details:

My questions:

  1. Is using a Windows service the right approach for this scenario?
  2. If yes, how can I ensure that the spawned application retains authorization to use the COM object, even when no user is logged in?

Any guidance or suggestions on how to resolve this issue would be greatly appreciated!

Upvotes: 0

Views: 64

Answers (1)

claudegia
claudegia

Reputation: 21

I solved the problem. My problem was that the COM Object "Identity" property was setted on "Interactive user", so obviously when i disconnected from the session it ceased to work. My solution was to set a specific user and run the Service under that user. Thanks for your answer.

Upvotes: 0

Related Questions