Question Create a Windows Service in VS 2008 Pro

paris_tj

Member
Joined
Mar 2, 2010
Messages
7
Programming Experience
Beginner
Ok, I feel real stupid on this subject as I have tried for a month to get my simple windows service I made to run. It runs, and when a entry is added to the security log, it sends a email. Simple, usless, but it was to test that I could create a service.

I have issues with the InstullUtil.exe and the sniplet below.

Adding Installer to the Project
Open the Service1.vb design window and right-click and then select the Add Installer option. This adds an installer project, ProjectInstaller.vb, with two controls, ServiceProcessInstaller1 and ServiceInstaller1, in our existing project.

Select the ServiceInstaller1 control and open the property window. Change the ServiceName and DisplayName properties to MyService. (This is the name you want to appear in the list of services in Services windows.)

Select the ServiceProcessInstaller1 control and open the property window. Change the Account property to LocalSystem. (This needs to be specified because we need to run this on our local machine.)

Now it time to build the application and create an executable. Select Build Solution from the Build menu to create an executable with installation instructions for the service.


Installing assembly 'C:\Users\Donald\Documents\Visual Studio 2008\Projects\WindowsService1\WindowsService1\bin\Release\windowsservice1.exe'.
Affected parameters are:
logtoconsole =
assemblypath = C:\Users\Donald\Documents\Visual Studio 2008\Projects\WindowsService1\WindowsService1\bin\Release\windowsservice1.exe
logfile = C:\Users\Donald\Documents\Visual Studio 2008\Projects\WindowsService1\WindowsService1\bin\Release\windowsservice1.InstallLog
No public installers with the RunInstallerAttribute.Yes attribute could be found in the C:\Users\Donald\Documents\Visual Studio 2008\Projects\WindowsService1\WindowsService1\bin\Release\windowsservice1.exe assembly.
Committing assembly 'C:\Users\Donald\Documents\Visual Studio 2008\Projects\WindowsService1\WindowsService1\bin\Release\windowsservice1.exe'.
Affected parameters are:
logtoconsole =
assemblypath = C:\Users\Donald\Documents\Visual Studio 2008\Projects\WindowsService1\WindowsService1\bin\Release\windowsservice1.exe
logfile = C:\Users\Donald\Documents\Visual Studio 2008\Projects\WindowsService1\WindowsService1\bin\Release\windowsservice1.InstallLog
No public installers with the RunInstallerAttribute.Yes attribute could be found in the C:\Users\Donald\Documents\Visual Studio 2008\Projects\WindowsService1\WindowsService1\bin\Release\windowsservice1.exe assembly.
Remove InstallState file because there are no installers.
Any chance someone can send me a blank service that is setup correctly so I can see what I am doing wrong, or assist me.
 
Some thoughts

I had the same issue when I tried to use the installutil.exe the first time. Then I found that I needed to add an installer to the project oddly enough with the same instructions you posted.

When I built the project I had the ProjectInstaller.vb file selected. I wouldn't think this makes a diffrence but it cannot hurt.

Next copy the built file from your project folder to a diffrent maybe like this C:\MyService\MyService.exe

Then open the command window and run the installutil.exe again.

Ty
 
Back
Top