Answer the question
In order to leave comments, you need to log in
Which command can run a regular application as a Windows service?
How to create, register a new Windows service from a regular application and put it on startup?
Will this app have admin rights?
Answer the question
In order to leave comments, you need to log in
Powershell
CMD
also
nssm.cc
How to put a service into startup? set it to auto start.
What rights will the service have? such as the account under which you will run it.
In general, you can do this:
https://gist.github.com/alexkuznetsov/b4880005d73c...
This is the registration of a windows service from the application itself. But, you need to run it as administrator.
That is, answering your question directly:
And then you can install it via
ManagedInstallerClass.InstallHelper(new string[] { "absolute\path\to\assembly.exe" });
No normal application. If you are writing an application, then the development environment you are using must have the application type "Service". Events and commands should be handled (At the very least, Windows should know that the service has successfully started and not hung).
Service - runs from under the system, and most of today's applications have Gui. That is, it will not be displayed. There must be an option for the application to work in the background.
As a rule, services can be installed from the console and run with the /install
/uninstall option, respectively, uninstallation.
You can try to run the application through the scheduler (you can choose when to run and on what name), adding a task there, in fact it will be the same, the application will appear in the processes, there will be no possibility to stop / restart it.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question