In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly shows you the "sample analysis of Windows service program development in C#", which is easy to understand and well-organized. I hope it can help you solve your doubts. Let the editor lead you to study and study the "sample analysis of Windows service program development in C#".
Step 1 of C#Windows service program development: first write a service with .net
Create a new service, right-click on the design page, after the menu appears, select add installer. A new page appears with controls serviceProcessInstaller1 and serviceInstaller1
Change the attribute Account to LocalSystem in serviceProcessInstaller1
In serviceInstaller1, change the attribute Parent to serviceProcessInstaller1 ServiceName, which is the name of the generated service (set the name to gogo)
Step 2 of C#Windows service program development: after changing the properties of this control. Go back to the background of the newly created service page and add the following code:
Process p = new Process (); p.StartInfo.FileName = "path and file name of the program"; p.Start ()
After the addition is complete, generate it (assuming the name is W2.exe). Go to the appropriate folder to find the generated exe file, and when you find it, you will find that there are two .exe ones with shorter names. Copy this file to a memorable folder such as the root directory of the F disk.
This is the time to install a service. Enter the screen in cmd and the files in Framework2.0, such as:
Cd C:\ WINDOWS\ Microsoft.NET\ Framework\ v2.0.50727
After the fight
InstallUtil f:\ w2.exe this installs the service uninstall service is InstallUtil f:\ w2.exe-u
Step 3 of C#Windows service program development: now all that is left is to start the service
Net start gogo so this service starts, this service opens, I will run the program, open the program I need is for the system user to open, so that I will not log out of the user and end the program I need, at this time in the end of the gogo service on the line, because it just plays a transitional role, saving some resources for the server.
The above is all the contents of the article "sample Analysis of Windows Service Program Development in C#". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.