VS2010 some issues when building a Windows Service project

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.