Your article on Window service was excellent. I have tried your example as well. But tried to write a simple code on a window service like showing a message box in every 10 secs once the service is started. The service got installed using the InstallUtil command but it could not be started. When we opt start from services window it brings up a dialog saying that "The service returned no error. This could be a problem with internal Window....". Is it possible to write such pure VB code as we do in a typical Window Application? I have written an application that does some website monitoring at regular intervals, I would like turn it into a Service. Please reply. Thankyou
This example is very easy to follow, and nicely demonstrates how to set up a service.
However, my file paths do not follow the 8.3 naming format that is used in this example. If your path to the exe is in the long format (contains spaces or is longer than 8 characters) make sure to enclose the path in quotes:
InstallUtil "C:\Visual Studio 2005\Projects\Myservice\Bin\Myservice.exe"
Good overview. I'm writing my first service now and this article helped. However, I have a question.
The control applet used to start and stop the services has a column for a Description. How do we add a Description for our service?
Posted by Chuck
on 01/24/2013 05:35pm
You can set the service description on the ServiceInstaller1 properies.
I get the following error when I attempt to install th service on my local XP machine:
Unable to create an instance of the MBService.ProjectInstaller installer type.
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
The inner exception System.Security.SecurityException was thrown with the following error message: Security error..
Installing assembly 'h:\my documents\visual studio projects\mbservice\bin\mbservice.exe'.
Affected parameters are:
assemblypath = h:\my documents\visual studio projects\mbservice\bin\mbservice.exe
logfile = h:\my documents\visual studio projects\mbservice\bin\mbservice.InstallLog