473,387 Members | 1,493 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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 7736
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Peter Schmitz | last post by:
Hi, how can I programmatically (NOT by MSI) install a .net service? Thanks a lot Peter
4
by: DraguVaso | last post by:
Hi, I developped a Windows Service in VB.NET (2005). I need to have it installed two times on 1 machine. When I want to install it a second time, the setup doesn't allow me to install it again...
2
by: Vince Keller | last post by:
I dont know if this is the correct newsgroup to post questions on Windows Service. I am trying to install and uninstall a Windows Service programmatically. As far as I know, there isnt a class...
3
by: Jeremy S. | last post by:
On my dev machine (XP/Pro with VS.NET 2003) I have been developing a Windows Service and installing it on the local machine by opening the Visual Studio Command Prompt and then executing . Now I...
3
by: Chris Wagner | last post by:
Anyone knows how to install/unistall service with VB.NET without using InstallUtil program? Thanks
1
by: Peter Schmitz | last post by:
Hi, how can I programmatically (NOT by MSI or a setup project) install a .net webservice? Thanks a lot Peter
1
by: amirmira | last post by:
I would like to set command line arguments to a service at install time. I need to do this because I need to get information from different registry locations depending on my command line argument....
4
by: UJ | last post by:
How could I have a program uninstall a service and then install a newer version of the same service? This assumes I've already got the files in the appropriate directory to be able to install the...
3
by: Steve | last post by:
Hi All I have a Windows forms POS program and have windows xp printer drivers for the Posiflex printers the customers use Is it possible to automatically install a windows printer driver (and...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.