1. Debug the Windows Service project that was established.
Online to find some of the methods of debugging Windows Services, many of the proposed copy to WinForm debugging, the rookie through the leadership of the guidance has a good debugging method, Mrak:
How to build not much to say, there are many online posts and articles.
The Windows Service project is listed below in the solution directory. (where ProjectInstaller.cs and. BAT processing are not built-in)
Program.cs is the file to be changed by the Debug. Its code is simple, as follows:
Right-click the project to Debug.
2. When a new Windows Service project calls other DLLs, the reference can be referenced normally, but the rebuild will prompt the error and the referenced DLL is invalidated. I wonder if you have ever encountered such a problem.
The reason was later found due to the target framework. For example, the Windows Service project defaults to the . NET Framework 4 Client Profile, and the Lite framework may not be fully functional,
After you change to the. NET Framework 4, reference issues are resolved.
3, debugging No problem, began to establish our service, after the rebuild, the solution directory under the Bin\Debug directory will have our built EXE file.
Below we will open our service. Run the-->cmd input installation command:
Installation:
SC Create service name binpath= F:\WindowsService\GetPriceService\bin\Debug\GetPriceService.exe Start=auto displayname= Getcompareprice
SC Description Service name It's a self-built win service.
Pause
Unloading:
sc stop service Name
SC Delete Service Name
Pause
Enter the installation command is correct, you can see in the service management of our established "Service name" service, my side of the default is automatically not enabled, right-click Enabled.
My first article, if there are errors, please ask the Friends of the garden, if other friends or Daniel have a better way to achieve, welcome to share.
VS2010 some issues when building a Windows Service project