Click to See Complete Forum and Search --> : Service installing
billy_rud
September 1st, 2008, 09:33 AM
Hey,
I'm currently working on a program that needs to install other programs as services. I can't seem to find anything in C# to do this.
Is there anything in C# that can do this? If not, what would be the best way to go about doing it? Calling an unmanaged api?
MadHatter
September 1st, 2008, 10:19 AM
yep, you gotta wrap the platform sdk for it. even then, the programs you install have to inherit ServiceBase and get run from main. I wrote a sample of how to do it. http://sanity-free.org/misc/ServiceInstaller.zip
.net services have to implement a couple of installer classes, then you have to invoke the installutil executable that comes w/ the framework to install the service. If you use the platform sdk to install the services, you don't have to include the installer classes (only if you use installutil.exe).
billy_rud
September 1st, 2008, 10:28 AM
Thanks for the reply and the services example. Maybe I'm misunderstanding part of your post. But the program I'm making is to install other programs, that I have no access to code for.
Their not coded in .NET either, so there's no way for me to make them inherit servicebase.
Arjay
September 1st, 2008, 11:13 AM
It's not clear from your question whether the programs you wish to install were originally written as services? Were they?
billy_rud
September 1st, 2008, 11:17 AM
No they were not, guess I should have also pointed that out.
Arjay
September 1st, 2008, 06:10 PM
On the Win32 api level, an application written to be used as a service needs to expose some functions that the SCM (Service Control Manager) can tie into. In .Net these functions are supplied when you derive from ServiceBase. If the application wasn't originally written as a service, you aren't going to have these functions so the app can't function as a service. In other words, getting an application to run as a service is more than just installing it a certain way.
eclipsed4utoo
September 2nd, 2008, 07:22 AM
are there .exe for you to run? how exactly are you wanting to "install" them?
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.