CMB.Services
1.1.1.46
dotnet add package CMB.Services --version 1.1.1.46
NuGet\Install-Package CMB.Services -Version 1.1.1.46
<PackageReference Include="CMB.Services" Version="1.1.1.46" />
paket add CMB.Services --version 1.1.1.46
#r "nuget: CMB.Services, 1.1.1.46"
// Install CMB.Services as a Cake Addin #addin nuget:?package=CMB.Services&version=1.1.1.46 // Install CMB.Services as a Cake Tool #tool nuget:?package=CMB.Services&version=1.1.1.46
Service Library Documentation
The Service Library will allow you to create a Windows service but also run it as a console application. What mode to run the service in shall be controlled by using either the ConsoleServiceController or WindowsServiceController classes. The service must be implemented in a class that derives from the Service class.
Implementing a Service
Below is a simple example of a service implementation:
class MyService : Service
{
public MyService()
: base("My Service Name")
{
}
protected override void OnStart(string[] args)
{
// Service start up code goes here
}
protected override void OnStop()
{
// Service shut down code goes here
}
}
Running as a Windows Service
To run the service as an actual Windows service, use the WindowsServiceController class to start the service.
var service = new MyService();
var controller = new WindowsServiceController();
controller.Run(service);
Running as a Console Application
To run the service as a console application, use the ConsoleServiceController class to start the service.
var service = new MyService();
var controller = new ConsoleServiceController();
controller.Run(service, ConsoleServiceOptions.WaitForStop);
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET Framework | net45 is compatible. net451 was computed. net452 was computed. net46 was computed. net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
This package has no dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.