473,616 Members | 2,973 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Installing Services

Hi there,
in the past when we have written services with C++, we used
to install them by running the .exe with command line parameters for
install/uninstall. Is this still possible with .Net? If this is not
possible, do I need to take the InstallUtil.exe with me to install on
customer site, or can I create a deployment package to do this for me?

Thanks.
Nov 16 '05 #1
7 4350
Well, I use the InstallUtil.exe

Install: C:\WINDOWS\Micr osoft.NET\Frame work\v1.1.4322\ installutil
yourService.exe
Uninstall: C:\WINDOWS\Micr osoft.NET\Frame work\v1.1.4322\ installutil /u
yourService.exe
"Waldy" <wa***@notmail. com> schrieb im Newsbeitrag
news:uj******** ******@TK2MSFTN GP15.phx.gbl...
Hi there,
in the past when we have written services with C++, we used
to install them by running the .exe with command line parameters for
install/uninstall. Is this still possible with .Net? If this is not
possible, do I need to take the InstallUtil.exe with me to install on
customer site, or can I create a deployment package to do this for me?

Thanks.

Nov 16 '05 #2
Yes, it's possible:

public void DoInstall(bool install)
{
// install or uninstall the service
using (TransactedInst aller ti = new TransactedInsta ller())
{
using (Installer inst = CreateInstaller ())
{
ti.Installers.A dd(inst);
string path = "/assemblypath=" + Assembly.GetEnt ryAssembly().Lo cation;
InstallContext ctx = new InstallContext( @"C:\install.lo g", new string[]
{ path });
ti.Context = ctx;

if (install)
{
Hashtable dict = new Hashtable();

try
{
ti.Install(dict );
}
catch (Exception e)
{
ti.Uninstall(nu ll);
throw;
}
}
else
{
ti.Uninstall(nu ll);
}
ti.Installers.R emove(inst);
}
}

May contain errors, this is a snippet from my own code.

HTH,
Stefan

"Waldy" <wa***@notmail. com> wrote in message
news:uj******** ******@TK2MSFTN GP15.phx.gbl...
Hi there,
in the past when we have written services with C++, we used
to install them by running the .exe with command line parameters for
install/uninstall. Is this still possible with .Net? If this is not
possible, do I need to take the InstallUtil.exe with me to install on
customer site, or can I create a deployment package to do this for me?

Thanks.

Nov 16 '05 #3
Hi,

No, you can but you don't have to

The best way to install a win service is including a Installer in the
project ( right click on the project name in the project explorer) and add a
Setup project to the solution, add a custom action consisting of the primary
output of the win service and you are really to go.

Ps : I have a link somewhere from MSDN for this approach I will look for it
in case you need further help

cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Waldy" <wa***@notmail. com> wrote in message
news:uj******** ******@TK2MSFTN GP15.phx.gbl...
Hi there,
in the past when we have written services with C++, we used to install them by running the .exe with command line parameters for
install/uninstall. Is this still possible with .Net? If this is not
possible, do I need to take the InstallUtil.exe with me to install on
customer site, or can I create a deployment package to do this for me?

Thanks.

Nov 16 '05 #4
"Stefan Simek" <si********@kas comp.blah.sk> wrote in message
news:O9******** ******@TK2MSFTN GP10.phx.gbl...
Yes, it's possible:

public void DoInstall(bool install)
{
// install or uninstall the service
using (TransactedInst aller ti = new TransactedInsta ller())
{
using (Installer inst = CreateInstaller ())
{
ti.Installers.A dd(inst);
string path = "/assemblypath=" + Assembly.GetEnt ryAssembly().Lo cation;
InstallContext ctx = new InstallContext( @"C:\install.lo g", new string[]
{ path });
ti.Context = ctx;

if (install)
{
Hashtable dict = new Hashtable();

try
{
ti.Install(dict );
}
catch (Exception e)
{
ti.Uninstall(nu ll);
throw;
}
}
else
{
ti.Uninstall(nu ll);
}
ti.Installers.R emove(inst);
}
}

May contain errors, this is a snippet from my own code.

HTH,
Stefan


Hi Stefan,
the CreateInstaller () call does not appear to be part of
..Net. What code is in this function?

Thanks.
Nov 16 '05 #5
Stefan,
how did you get hold of the command line parameters as no args
are passed into main?

Nov 16 '05 #6

"Waldy" <wa***@notmail. com> wrote in message
news:u6******** ********@TK2MSF TNGP14.phx.gbl. ..
"Stefan Simek" <si********@kas comp.blah.sk> wrote in message
news:O9******** ******@TK2MSFTN GP10.phx.gbl...
Yes, it's possible:

public void DoInstall(bool install)
{
// install or uninstall the service
using (TransactedInst aller ti = new TransactedInsta ller())
{
using (Installer inst = CreateInstaller ())
{
ti.Installers.A dd(inst);
string path = "/assemblypath=" + Assembly.GetEnt ryAssembly().Lo cation;
InstallContext ctx = new InstallContext( @"C:\install.lo g", new
string[]
{ path });
ti.Context = ctx;

if (install)
{
Hashtable dict = new Hashtable();

try
{
ti.Install(dict );
}
catch (Exception e)
{
ti.Uninstall(nu ll);
throw;
}
}
else
{
ti.Uninstall(nu ll);
}
ti.Installers.R emove(inst);
}
}

May contain errors, this is a snippet from my own code.

HTH,
Stefan


Hi Stefan,
the CreateInstaller () call does not appear to be part of
.Net. What code is in this function?

Thanks.


Sorry, my fault... I just cut the previous snippet out, I didn't realize it
calls another...

The CreateInstaller () goes as follows, hope it should be complete now.

Installer CreateInstaller ()
{
Installer inst = new Installer();

ServiceProcessI nstaller spi = new ServiceProcessI nstaller();
spi.Account = account;

ServiceInstalle r si = new ServiceInstalle r();
si.DisplayName = name;
si.ServiceName = name;
si.StartType = startMode;

inst.Installers .AddRange(new Installer[] { spi, si });

return inst;
}

HTH,
Stefan
Nov 16 '05 #7

"Waldy" <wa***@notmail. com> wrote in message
news:eD******** ******@TK2MSFTN GP15.phx.gbl...
Stefan,
how did you get hold of the command line parameters as no args
are passed into main?


What do you mean by: no args are passed into main?

If you need the arguments, declare your main function as:

public static void Main(string[] args)
{
...
}

If you need to retrieve the arguments somewhere else in your code, you can
use Environment.Get CommandLineArgs (), but beware, this also returns
executable name as the first element of the array, so it's not directly
interchangeable with the args passed to main...

HTH,
Stefan
Nov 16 '05 #8

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

Similar topics

2
2574
by: y_oda2002 | last post by:
Hi everyone I was wondering if anyone could help me. I am trying to install ph so that i can learn the code. So far i havent had any problem installing apache. However when i try to get mysql to run wit apache and php the windows services gives an error upon startin apache. Something lik error module not found. php_mysql.dll does not exist
1
4535
by: Walter Jones | last post by:
I am currently using VB 4.0 with WindowsXP Home Edition and would like to continue to use it and also use Visual Basic.net The help file states that "Windows XP Home Edition provides limited functionality. Creating Web applications or XML Web services is not supported when using Windows XP Home Edition." I am not interested in Web applications or XML Web services. When I run Setup I get the Visual Studio.NET Setup screen with "1 Visual...
1
1534
by: ajackson | last post by:
i am having some trouble installing SQl server Reporting Services. well, in order to install the reporting services i have to install Service Pack 3a. so through my installation of package 3a i am encoutering some trouble. i was able to comlete the first part of the installation i receive this error message: Instance name specified is invalid so, my question is: once you have SQL Server installed, where can you
4
2050
by: Claire | last post by:
Hi, I know this isn't strictly C# language related, but my service IS written in c# and I checked out the list of microsoft newsgroups for win2000 and couldn't really see one that applies. I'm trying to test my service on a remote win2000 server machine, accessing the machine as user "administrator" on remote desktop. Im just at the install stage and using the installutil.exe to register the service on the server. The install appears to...
1
1990
by: Jeevan | last post by:
Hi, I am creating a Window Service in C-Sharp. The Window Service has a reference to an OCX file created in VC++. In OnStart method I have created an instance of the class, of the OCX file and called a method of the class. Compilation was successful. I created a Windows installer setup(.MSI), for installing the service. The installation was successful. I started my service from the Services Management Console. It started and stopped...
2
1605
by: J | last post by:
hi, I'm having a problem installing a service created in vb.net 2003 on a windows 2000 server. I have installed the service on a few XP machines with out any problems...but the 2 servers (win 2000 server sp4) I have triend have the same error (both are on diffrent domains and have framework v1.1 installed; 1 is a domain controler, the other is not) An exception occurred during the Install phase. System.ComponentModel.Win32Exception:...
0
4838
by: Anonieko Ramos | last post by:
Self Installing Service Enter a topic name to show or a new topic name to create; then press Enter .. Start by writing a service. This involves deriving a class from System.ServiceProcess.ServiceBase and overriding a few methods. It's detailed in the documentation. Once you have your service written, you'll need to add an installer
3
1552
by: Mukesh | last post by:
Hi friends i wants to install a service (MS application Block) on the server using a web application. Can i do this if yes then how can i do this I m using MS VisualStudio.net 2003, C#, .net1.1 Mukesh Delhi India
15
2420
by: =?Utf-8?B?RWxpb3Ro?= | last post by:
I try to install Windows Services but it show this error during the installation process, "Insufficient System resources exist to complete the requested service." I created this Services in VB 2005. I has other Windows Services installed on this machine. I try to install in other computer with the same specification and its is OK. Specification
2
2009
by: Tam | last post by:
Im running into problems installing either VS 05 or 08 on a Vista Premium 64 bit machine and, ahem, it isnt going sweetly. When installing i get an "Error 1935.An error occured during the installation of assembly component" when installing either 05 or 08. Vista Premium comes with .NET Framework 2.0 and Framework 3.5 which are both present. It also has Framerwork 1.0 SP3 Developer. As an
0
8647
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8297
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8449
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7121
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5550
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4063
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2579
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1759
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1445
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.