I am getting an exception when trying to unistall my service saying the filenotfoundexception...but the directory is currently set where the file is c:\Mydata\bin\release> InstallUtil/u.exe Service1 is how its reads on my CMD then it throws this exception.....
That’s not the error you get when you build your service, that’s the error you get when you try to debug it, (likely due to hitting f5).
In order to debug a service there are 3 things you need to do, first you need to install it, next you need to start it and finally you need to attach to it.
To install it you need to call InstallUtil.exe and pass in the name (and likely path) of your service executable.
To start the service you’ll need to use NET START at the command line and pass in the name of your service (often the same as the filename but without the .exe).
Finally, to debug it you’ll want to look under the Debug menu and then choose Processes. From the new window you need only select the running process on your system that you want to attach to and hit ok and wait a moment or three to connect to it.
You are close... the syntax to remove it would be:
InstallUtil.exe /u ServiceFileName.exe
If you are still getting a FileNotFoundException you'll want to make sure that where you are calling InstallUtil from can see that directory, otherwise you could specify the full path to the service ala:
InstallUtil.exe /u "C:\My Dev Apps\Service Test\bin\debug\ServiceFileName.exe"
--------------------------- Windows Service Start Failure --------------------------- Cannot start service from the command line or a debugger. A Windows Service must first be installed (using installutil.exe) and then started with the ServerExplorer, Windows Services Administrative tool or the NET START command.
Is this the right forumn for this topic....This is the error i get...when i try to build my service.....Any help on what i should do would be awesome!
C#console changed to a service
mahima
sarashare
That’s not the error you get when you build your service, that’s the error you get when you try to debug it, (likely due to hitting f5).
In order to debug a service there are 3 things you need to do, first you need to install it, next you need to start it and finally you need to attach to it.
To install it you need to call InstallUtil.exe and pass in the name (and likely path) of your service executable.
To start the service you’ll need to use NET START at the command line and pass in the name of your service (often the same as the filename but without the .exe).
Finally, to debug it you’ll want to look under the Debug menu and then choose Processes. From the new window you need only select the running process on your system that you want to attach to and hit ok and wait a moment or three to connect to it.
Does this work for you
Douglas H. Troy
Gregory English
First: Have everything in a dll, your console app should call the dll to start the application.
Second: Create a Windows Service project (in the same solution if you want) and then call your dll.
This way you can compile the project you want (service/console) and they will both use the same code as it is all in the dll.
Scoutn
You can do it from the commandline where InstallUtil is located within the folder: %windir%\Microsoft.NET\Framework\v<framework version>\
For me I throw a couple of pre and post build events into my project so that the pre-build steps include:
net stop MyServiceName
"%windir%\Microsoft.NET\Framework\v1.1.4322\InstallUtil.exe" /u MyService.exe
Here we stop the service and uninstall it and then to the opposite in the post build:
"%windir%\Microsoft.NET\Framework\v1.1.4322\InstallUtil.exe" MyService.exe
net start MyServiceName
Ather.
"To install it you need to call InstallUtil.exe and pass in the name (and likely path) of your service executable."
This is my first time using a service...do i call the InstalUtil.exe at the command prompt
Intern
You are close... the syntax to remove it would be:
InstallUtil.exe /u ServiceFileName.exe
If you are still getting a FileNotFoundException you'll want to make sure that where you are calling InstallUtil from can see that directory, otherwise you could specify the full path to the service ala:
InstallUtil.exe /u "C:\My Dev Apps\Service Test\bin\debug\ServiceFileName.exe"
TGirgenti
---------------------------
Windows Service Start Failure
---------------------------
Cannot start service from the command line or a debugger. A Windows Service must first be installed (using installutil.exe) and then started with the ServerExplorer, Windows Services Administrative tool or the NET START command.
Is this the right forumn for this topic....This is the error i get...when i try to build my service.....Any help on what i should do would be awesome!
Surezsu