GitHub Address: Https://github.com/xl711436/Xiaolei.MockService
The corresponding logic is added to the corresponding method in the MockServiceInstance.cs, where the constructor completes the service initialization logic, and the logic in the start and stop methods is called at the start and end of the service respectively.
Public classMockservcieinstance {/// <summary>mark of whether the service ended/// </summary> Public BOOLExitflag {Get;Set; } Publicmockservcieinstance () {Tracehelper.traceinfo ("Mockservcie Instance"); } Public voidStart () {Tracehelper.traceinfo ("Mockservcie Start"); } Public voidStop () {Tracehelper.traceinfo ("Mockservcie Stop"); } }
Once the compilation is complete, this article, combined with the Windows service wrapper, uses the configuration of the second mode to deploy the relevant logic as a Windows service.
Windows Service Wrapper templates