473,326 Members | 2,061 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,326 software developers and data experts.

Creating Install for Services

I found it surprisingly unintuitive and difficult to get the
installation code to work properly and I found very little help on the
google groups so I figured I’d post the things that burned me so
someone else doesn’t have to work through the same issues.

I created a service using the wizard and then I added an Installer
class. On the canvas of the installer class I plopped down an
instance of a ServiceInstaller and a ServerProcessInstaller. After I
thought I had everything set up correctly I tried running
InstallUtil.exe on my service exe.

Problem #1:
I got the following error:
System.BadImageFormatException: The format of the file
'SnapshotAnalyzer.exe' is invalid
I come to find out that somehow the .NET 1.1 was in my path BEFORE
the .NET 2.0 path (for whatever reason). I got rid of the .NET 1.1
from my path.

Problem #2:
I got the following error:
System.InvalidOperationException: Installation failed due to the
absence of a ServiceProcessInstaller. The ServiceProcessInstaller must
either be the containing installer, or it must be present in the
Installers collection on the same installer as the ServiceInstaller.
What I hadn’t realized is that the ServiceInstaller automatically had
its parent set to the Installer class but the ServiceProcessInstaller
did not so I had to manually set its parent property.

Problem #3:
I got the following error:
System.ArgumentException: Must specify value for source.
I hadn’t set the “ServiceName” on the ServiceInstaller instance. I
guess somehow I’m supposed to know that “source” and “ServiceName”are
really the same thing?

Also I found this article useful for making a service able to install/
uninstall itself without the use of installutil.exe. In addition
allow the service to run as a normal process so you can debug it:
http://www.eggheadcafe.com/articles/20060104.asp
The example is in Visual Studio 2003 but it’s easy enough to modify it
if you just add some public methods on the service class that just
call OnStart() and OnStop().

Jun 27 '08 #1
1 5216
Nobody who works with fully-featured installation tools uses installer
classes to install services. MSI has built-in support to do it "for free"
and pretty much all the tools *except* Visual Studio have IDE support to
populate the ServiceInstall and ServiceControl tables that have been in
Windows Installer since before .NET came along. A further irony is that the
Windows Installer team doesn't even support the managed code installer
classes used by Visual Studio to install services.
http://robmensching.com/blog/archive...and-heres.aspx
--
Phil Wilson

"Israel" <is**********@hotmail.comwrote in message
news:a4**********************************@79g2000h sk.googlegroups.com...
I found it surprisingly unintuitive and difficult to get the
installation code to work properly and I found very little help on the
google groups so I figured I’d post the things that burned me so
someone else doesn’t have to work through the same issues.

I created a service using the wizard and then I added an Installer
class. On the canvas of the installer class I plopped down an
instance of a ServiceInstaller and a ServerProcessInstaller. After I
thought I had everything set up correctly I tried running
InstallUtil.exe on my service exe.

Problem #1:
I got the following error:
System.BadImageFormatException: The format of the file
'SnapshotAnalyzer.exe' is invalid
I come to find out that somehow the .NET 1.1 was in my path BEFORE
the .NET 2.0 path (for whatever reason). I got rid of the .NET 1.1
from my path.

Problem #2:
I got the following error:
System.InvalidOperationException: Installation failed due to the
absence of a ServiceProcessInstaller. The ServiceProcessInstaller must
either be the containing installer, or it must be present in the
Installers collection on the same installer as the ServiceInstaller.
What I hadn’t realized is that the ServiceInstaller automatically had
its parent set to the Installer class but the ServiceProcessInstaller
did not so I had to manually set its parent property.

Problem #3:
I got the following error:
System.ArgumentException: Must specify value for source.
I hadn’t set the “ServiceName” on the ServiceInstaller instance. I
guess somehow I’m supposed to know that “source” and “ServiceName” are
really the same thing?

Also I found this article useful for making a service able to install/
uninstall itself without the use of installutil.exe. In addition
allow the service to run as a normal process so you can debug it:
http://www.eggheadcafe.com/articles/20060104.asp
The example is in Visual Studio 2003 but it’s easy enough to modify it
if you just add some public methods on the service class that just
call OnStart() and OnStop().
Jun 27 '08 #2

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

Similar topics

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...
0
by: Ken Wigle | last post by:
All, I am trying to add some .net applications I wrote to a virtual directory underneath the sharepoint services web site. I am having some problems and wondering if a) this is possible and/or...
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:...
1
by: Jon H | last post by:
I'm trying to create an installer application that can be run from a web page. I know visual basic pretty well, but I haven't work with asp.net very long. Is there a simple way to do this? When...
9
by: Rotzooi | last post by:
Hi, I have a VB.NET Service application that's running fine under the Local System account. But for configuration purposes I don't want to be dependent on modifying the registry manually or...
3
by: clsmith66 | last post by:
I hope this is just something stupid I'm missing and someone can easily point out my error. I'm trying to do a few turorials on windows services, and the couple I found so far just create an event...
1
by: Al Wilkerson | last post by:
Hey, Has anyone ever used InstallSheild to create a install/setup package for a ..net service? If so, did you just create the component service and enable the use of the ..Net Class and/or...
1
by: =?Utf-8?B?Qi5BaGxzdGVkdA==?= | last post by:
Hi all, This is something that I have been toying with for about a week now. What I want to achieve is Install a Service with Customised parameters (using InstallUtil.exe) for User Name. Example...
4
by: =?Utf-8?B?QWxoYW1icmEgRWlkb3MgRGVzYXJyb2xsbw==?= | last post by:
Hi all, I continue with installation. I create three windows services. Each service has a Installer class.
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.