Describe:
A software, already registered with a Windows service and enabled, now needs to add a field in the service's own class B, the role of the service is to return an instance of that type B
Practice
Add a field, replace the service file, re-register the service and open, but in a software service type or old version, the return of type B data has a new addition field, but a in-software service refers to the type of accepted data is the old type, there is no new fields added.
Windows Services
Ability to create executable applications that can run for long periods of time
System structure
-
system.serviceprocess. Servicebase-you override methods from the servicebase class when creating a SE Rvice and define the code to determine what your service functions in this inherited class. ">system.serviceprocess . ServiceBase --overrides the method from the ServiceBase class when creating the service and defines the code to determine how the service will run in this inheriting class.
-
system.serviceprocess. ServiceProcessInstaller and system.serviceprocess. Serviceinstaller-you use these classes to install and uninstall your service. ">system.serviceprocess . ServiceProcessInstaller and system.serviceprocess . ServiceInstaller --Use these classes to install and uninstall services.
- ServiceController to communicate with existing services and control their behavior.
Create a Windows service
1 Write the service programmatically.
2 Creating a service with the SV template
There are two ways to do the following things
Sets the ServiceName property.
Create the necessary setup programs for your service application.
Override and specify the code for the OnStart and OnStop methods to customize the way your service behaves.
- Required installers for adding service applications
- Build your project by selecting Build Solution from the build menu
required installers for adding service applications
Switch to design, right-click Add Installer
Two files generated on the interface Serviceinstaller1,serviceprocessinstaller1
One can adjust the service startup type, one to set the account access rights
The ServiceProcessInstaller component applies to all individual service installers in a project.
There seems to be no relationship between the added installer and your service principal, just a record of the service's
Install the Windows service (services generated by the class)
Administrator Open Vstool under the VS2012 Developer command prompt, CD to exe directory, InstallUtil xxx.exe (normal admin cmd not)
Then just install, start the service
(My test program is open a file, but the file is not opened, manual re-open will show that the file is occupied, it may not have a single interface related to the service)
Conclusion
Windows service differs from normal exe execution file, cycle depends on application, Windows service life cycle is long
Registering an application as a service using the InstallUtil method
About the problem:
Why is the service update incorrect?
Because I changed the service address: it was Http://192.168.40.31:8400/ACal/BaseService/mex.
Later, the address of my registered service is: Http://192.168.40.31:8700/ACal/BaseService/mex
The service port registered on this machine has changed, the software refers to an address without service, the service can not be updated naturally
6.28 Windows serviece