FAQs about creating and publishing Windows Services

Source: Internet
Author: User

1. How to install the service?

Installutil.exe, a service installation tool provided by. Net framework.exe, is located in the c: \ windows \ microsoft. net \ framework \ v1.1.4322 \ folder.

Run the Visual Studio. NET 200 * command. The installation command is:

Installutil c: \ test.exe (C: \ test.exe is the Windows service to be installed. If the path contains spaces, you need to add quotation marks outside, for example, installutil "C: \ Program Files \ test.exe ")

To open the DOS console, add the path before installutil. The command format is as follows:

C: \ windows \ Microsoft. NET \ framework \ v1.1.4322 \ installutil.exe C: \ test.exe

Uninstall the service and add the-u parameter after installutil:

Installutil-U c: \ test.exe

2. In the installation dialog box, enter the user name and password. How can I remove the input box?

In the Visual Studio development environment, open the windows Service Project and find the project installer file. CS, which is a built-in installation file after the Windows service is created. It contains settings such as the password and name of the installation service and the initialization method.

ViewCode, Find the method initializecomponent (), and set the Logon account to the Local Account of the system:

This. serviceprocessinstaller1.account = system. serviceprocess. serviceaccount. LocalSystem;

3. How can I modify the Windows Service name?

After installing the service, we can see the service component you registered in the "service" window. Right-click the service component and choose start service from the menu. How can I modify the service name?

Similarly, in the initializecomponent () method of the projectinstaller. CS class, add the following settings:

This. serviceinstaller1.displayname = "test server ";

Note: This is only the alias of the service. In fact, the actual name of the service is this. serviceinstaller1.servicename. If two windows services have the same servicename when you register the service, an existing service exception will be thrown (even if your displayname is different ).

4. The configuration file cannot be found.

If the Windows Service hasExcept app. cofigTo the directory where the .exe file is installed. For example, if you install the c: \ test.exe service, copy the configuration file to the C: \ directory.

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.