473,386 Members | 1,820 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,386 software developers and data experts.

How to install Windows Service

Could someone suggest me as to how to install an
Windows Service in C#? I do not want to use InstallUtil
as I need to pass a parameter, which is not possible.
I do not want to use write an installer application
either. I want to install from Command Line prompt
from .NET and pass in different parameter values
hsomething
like,
ServiceName /Install
/ABC=""
/XYZ=""

Thank you in advance
-Shani

Nov 16 '05 #1
2 11865
"Shani" <an*******@discussions.microsoft.com> wrote in message
news:36****************************@phx.gbl...
Could someone suggest me as to how to install an
Windows Service in C#? I do not want to use InstallUtil
as I need to pass a parameter, which is not possible.
I do not want to use write an installer application
either. I want to install from Command Line prompt
from .NET and pass in different parameter values
hsomething
like,
ServiceName /Install
/ABC=""
/XYZ=""


Use the ServiceInstaller class but, don't add the [RunInstaller] attribute.
Then, in your service's "main", look for the /Install parameter, if it's
present, create an instance of your ServiceInstaller based class and call
the .Install method.
Nov 16 '05 #2
"John Vottero" <Jo**@mvpsi.com> wrote in message
news:u4**************@TK2MSFTNGP11.phx.gbl...
"Shani" <an*******@discussions.microsoft.com> wrote in message
news:36****************************@phx.gbl...
Could someone suggest me as to how to install an
Windows Service in C#? I do not want to use InstallUtil
as I need to pass a parameter, which is not possible.
I do not want to use write an installer application
either. I want to install from Command Line prompt
from .NET and pass in different parameter values
hsomething
like,
ServiceName /Install
/ABC=""
/XYZ=""


Use the ServiceInstaller class but, don't add the [RunInstaller]
attribute. Then, in your service's "main", look for the /Install
parameter, if it's present, create an instance of your ServiceInstaller
based class and call the .Install method.


Actually, your class should be based upon Installer and it will contain a
ServiceInstaller and a ServiceProcessInstaller, just like the examples in
the doc. The key difference is that you will be creating an instance and
calling .Install instead of leaving that up to InstallUtil or some other
installer.
Nov 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: raghavendra | last post by:
Hi, How to run automatically windows service by using setup deployment insatllation script using visual studio 2003.? What i did is :-- 1. created a windows service & tested the same. 2....
0
by: Stuart Whelan | last post by:
I am writing a service in C# with an internal service installer. I am running XP Pro SP with VS7.1 and .NET 1.1 It installed okay the first time, but during uninstall the app crashed. Now I...
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...
2
by: Fan Wang | last post by:
Hi All, I wrote a windows service with C# as below. But I can't install it with installutil.exe. I got an error message " Exception occurred while initializing the installation:...
3
by: Chad Smith | last post by:
Hi, I have created a .NET deployment project in Visual Studio 2003. I have specified an entry point into my own code in this installer which launches into the familiar: public override void...
4
by: kkt49 | last post by:
# vim: et sw=4 ts=8 sts from wxPython.wx import * import sys, os, time import pywintypes import win32serviceutil import win32service import win32event import win32process
3
by: JM | last post by:
Hi, I have created a Solution in VS 2005 with 2 simple projects. First project is simple Windows Service which writes an entry into event log when it starts and when it stops. Nothing else. I...
5
by: Ajith Menon | last post by:
I have to install .NET framework 3.0. I already have .NET Framework 1.1 installed on my machine. I don't want to remove framework 1.1 since some of the critical applications are using it. While...
2
by: =?Utf-8?B?Um9nZWxpbw==?= | last post by:
I know this has been answered, I just can't find it. can someone point me to a URL or thread that shows how to install a web service in a Windows Setup Project ? I need to install a windows app,...
0
by: =?Utf-8?B?QWxoYW1icmEgRWlkb3MgS2lxdWVuZXQ=?= | last post by:
Actually, my installer package is not for a Windows Service, but for a WinForms application. Well, it is kind of both: this is a multi-project solution with its main target being a WinForms...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: 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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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.