Click here to Skip to main content
15,887,027 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I recently built a C# console application and it is working fine when I execute the file.
However, the client requested that I run it as a service. Is that even possible without me recoding the entire application as a Windows Service app in c#? Another drawback is that I am not familiar with writing windows services if I convert it.
 
I have tried following instructions from https://www.howtogeek.com/50786/using-srvstart-to-run-any-application-as-a-windows-service/  but when I start my service it errors out with 1067:  The process terminated unexpectedly.
 
I am really unsure what to do at this point. Is there other way that I can run my console app as a windows service without having to re-code everything?
 
Thanks,
-h

What I have tried:

I already created a console app that runs without issues, but client requested we run this as a service. I know nothing about windows services, I want to learn but due to time constraint, Im looking for most efficient option possible.

Any suggestions or help really is much appreciated.

it has been a while and I am really starting to learn c# again.
Posted
Updated 22-Nov-17 22:37pm
Comments
ZurdoDev 16-Nov-17 11:16am    
Add logging to your app to find out why it crashes. And look in event viewer to see if there is any more info.

1 solution

Technically, no - a windows service has - and can have - no user interface at all, so even the console is out of bounds.

But ... depending on what your app does, and what use it makes of the console it should be possible to rewrite it to be a service. How difficult that process is will depend as usual on how well written the app was in the first place... :laugh:

This may help: Creating a Basic Windows Service in C#[^] - it's oldish, but still good.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900