Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make a C# application act as a service?

Tags:

c#

.net

windows

I have developed a C# program, although when I try and create a service from it e.g.

sc create "servicetest" binPath= 
   "C:\Users\Admin\Desktop\test\test.exe" start= auto error= ignore

I get the following message:

[SC] StartService FAILED 1053:

The service did not respond to the start or control request in a timely fashion.
like image 287
Peter Avatar asked Jan 20 '23 11:01

Peter


1 Answers

You need to create it as a service through the Visual Studio interface, which will provide you with the correct classes and methods you need to implement.

like image 197
Snake Avatar answered Jan 31 '23 02:01

Snake