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.