|
-
September 1st, 2008, 09:33 AM
#1
Service installing
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?
-
September 1st, 2008, 10:19 AM
#2
Re: Service installing
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).
-
September 1st, 2008, 10:28 AM
#3
Re: Service installing
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.
-
September 1st, 2008, 11:13 AM
#4
Re: Service installing
It's not clear from your question whether the programs you wish to install were originally written as services? Were they?
-
September 1st, 2008, 11:17 AM
#5
Re: Service installing
No they were not, guess I should have also pointed that out.
-
September 1st, 2008, 06:10 PM
#6
Re: Service installing
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.
-
September 2nd, 2008, 07:22 AM
#7
Re: Service installing
are there .exe for you to run? how exactly are you wanting to "install" them?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|