469,576 Members | 1,754 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,576 developers. It's quick & easy.

Install a Service Programmatically ?

Hi there,

I'm designing an application in C#. One of the files in my application
is "server.exe". This assembly listens for inbound connections and handles
various incoming requests. I want to give the user of my application the
option to allow server.exe to execute and handle requests even after the
user has logged off.

My plan is to ask the user "Would you like this service to continue
running after you log off?". If the user answers yes, I want to install
"server.exe" as a service. I've done this successfully in a manual way using
the 'installutil' .NET helper application, but my application will need to
do this in an automated way.

How can I accomplish this? Shall I shell out to a command prompt and
execute installutil against server.exe? Does the user need to be an
administrator of his machine? Can I be 100% certain that if the user has the
..NET framework installed that 'installutil' will be installed as well? If
so, how do I find it? Is there some sort of macro (i.e. %DOTNET_FOLDER% for
example) that will allow me to easily determine the dotnet folder where
'installutil' resides?

Is there any way to get server.exe to execute after a user has logged
off *other* than using a service? I'd appreciate any suggestions.

--
Sincerely,

David Sworder
http://www.CodeFanatic.com
Nov 15 '05 #1
3 7525
Hi David,

I surpose you already has added an installer component to your project ??

If so, you can use the AssemblyInstaller class in namespace
System.Configuration.Install to either install or uninstall your service.
If you want me to i can mail you an example

Soren
"David Sworder" <Gi********@CSILasVegas.com> skrev i en meddelelse
news:uO**************@tk2msftngp13.phx.gbl...
Hi there,

I'm designing an application in C#. One of the files in my application
is "server.exe". This assembly listens for inbound connections and handles
various incoming requests. I want to give the user of my application the
option to allow server.exe to execute and handle requests even after the
user has logged off.

My plan is to ask the user "Would you like this service to continue
running after you log off?". If the user answers yes, I want to install
"server.exe" as a service. I've done this successfully in a manual way using the 'installutil' .NET helper application, but my application will need to
do this in an automated way.

How can I accomplish this? Shall I shell out to a command prompt and
execute installutil against server.exe? Does the user need to be an
administrator of his machine? Can I be 100% certain that if the user has the .NET framework installed that 'installutil' will be installed as well? If
so, how do I find it? Is there some sort of macro (i.e. %DOTNET_FOLDER% for example) that will allow me to easily determine the dotnet folder where
'installutil' resides?

Is there any way to get server.exe to execute after a user has logged
off *other* than using a service? I'd appreciate any suggestions.

--
Sincerely,

David Sworder
http://www.CodeFanatic.com

Nov 15 '05 #2
> If so, you can use the AssemblyInstaller class in namespace
System.Configuration.Install to either install or uninstall your service.


Wow, how easy!... thanks!
Nov 15 '05 #3
Could you post it to the group?

Or at least post enough that we can go find it ourselves?

Thanks.

"Soren Staun Jorgensen" <no@spam.com> wrote in message
news:eE**************@TK2MSFTNGP11.phx.gbl...
Hi David,

I surpose you already has added an installer component to your project ??

If so, you can use the AssemblyInstaller class in namespace
System.Configuration.Install to either install or uninstall your service.
If you want me to i can mail you an example

Soren
"David Sworder" <Gi********@CSILasVegas.com> skrev i en meddelelse
news:uO**************@tk2msftngp13.phx.gbl...
Hi there,

I'm designing an application in C#. One of the files in my application is "server.exe". This assembly listens for inbound connections and handles various incoming requests. I want to give the user of my application the
option to allow server.exe to execute and handle requests even after the
user has logged off.

My plan is to ask the user "Would you like this service to continue
running after you log off?". If the user answers yes, I want to install
"server.exe" as a service. I've done this successfully in a manual way

using
the 'installutil' .NET helper application, but my application will need to do this in an automated way.

How can I accomplish this? Shall I shell out to a command prompt and
execute installutil against server.exe? Does the user need to be an
administrator of his machine? Can I be 100% certain that if the user has

the
.NET framework installed that 'installutil' will be installed as well? If so, how do I find it? Is there some sort of macro (i.e. %DOTNET_FOLDER%

for
example) that will allow me to easily determine the dotnet folder where
'installutil' resides?

Is there any way to get server.exe to execute after a user has logged off *other* than using a service? I'd appreciate any suggestions.

--
Sincerely,

David Sworder
http://www.CodeFanatic.com


Nov 16 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Peter Schmitz | last post: by
4 posts views Thread by DraguVaso | last post: by
2 posts views Thread by Vince Keller | last post: by
3 posts views Thread by Jeremy S. | last post: by
3 posts views Thread by Chris Wagner | last post: by
1 post views Thread by Peter Schmitz | last post: by
reply views Thread by suresh191 | last post: by
4 posts views Thread by guiromero | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.