views:

71

answers:

5

Is it possible to have a .exe run as a windows service?

A: 

Nope. It must inherit from ServiceBase and be installed to the OS as a service... The os basically is the process/context your code runs in.

Kevin Won
What? No. Another service could easily host something "as a service" for you. This is what srvany does. Also "the OS basically is the process/context your code runs in" doesn't begin to make sense and sounds like a terrible oversimplification of how operating systems work.And ServiceBase is a .NET class, you can write native services, too.
Matt Olenik
A: 

yes.

cygrunsrv (cygwin) http://web.mit.edu/cygwin/cygwin_v1.3.2/usr/doc/Cygwin/cygrunsrv.README or INSTSRV/SRVANY (microsoft) http://support.microsoft.com/kb/137890

steelbytes
A: 

This works great in Windows:

http://www.codeproject.com/KB/system/xyntservice.aspx

JR

Jj Rivero
A: 

A paid app, Application as service does this as well. It has a GUI for adding, removing and configuring services that makes things easy.

If you're comfortable with Cygwin though, it's free and I've used that to good effect also.

imoatama
A: 

This as well: RunAsService

Marc B