Deploying a Windows Service | Deployment Targets | BuildMaster | Inedo

A Windows Service is a program that runs in the background of the Windows OS environment, similar to a Unix daemon. In arrange to be considered a service, a program must adhere to the interfaces provided by the Service Control Manager ( SCM ). The SCM controls the succeed :

  • Database of installed services
  • Disk path of the programs/executables to run
  • Additional metadata for each service such as name, description, restart behavior, etc.

Services can be developed in .NET or in C/C++ using the Win32 API. Regardless of how they are developed, BuildMaster makes it easy to build and deploy them .

Building Windows Services

Building a service application in BuildMaster is basically the like as similar Building .NET Console Applications in BuildMaster. The main deviation is in how you deploy it .

Deploying Windows Services

Windows Services are typically deployed in two stages. For new services, an entry in the SCM must be created, whether it ‘s added manually by Operations personnel ( via sc.exe, PowerShell, or other mechanism ), or automated by a Configuration Management cock like Otter, Chef, Puppet, etc. For organizations who are not bound by operations restrictions, BuildMaster can good as well be configured to provision these services deoxyadenosine monophosphate well.

once the service entrance exists on a server, service build artifacts may be repeatedly deployed equally long as the service is stopped in the SCM anterior to deployment. It is important to note that a Windows Service does not need to be deleted and recreated each time a newly adaptation of the service is deployed .

Automating Windows Service Deployment with BuildMaster

While there are diverse methods to deploy a Windows Service, we recommend deploying them using the pursue general pattern :

  • Stop service (Windows::Stop-Service operation)
  • Deploy build artifact to the directory that contains the executable
  • Start service (Windows::Start-Service operation)

This group of operations can be performed on any server configured in BuildMaster. BuildMaster can interact with distant servers through agents. To specify which server to deploy the avail to, use a for server block in the OtterScript plan, or as a best-practice, specify a prey server in the pipeline stage target.

An example BuildMaster plan that deploys a serve on a server is :

for server us-east-svc-01
    Windows::Stop-Service HDarsService();
    Deploy-Artifact Service
        To: D:\Services\HDarsService
    Windows::Start-Service HDarsService();

Using the operations is basically the same as running the following PowerShell commands :

PS D:\Services\HDarsService> Stop-Service HDarsService
PS D:\Services\HDarsService> Expand-Archive -Path "E:\Artifacts\"
PS D:\Services\HDarsService> Start-Service HDarsService

additionally, there is an Windows::Ensure-Service operation that can be used. It has 2 minor differences from the above see operations :

  • the ensure operation is designed for Configuration Management (i.e. Otter)
  • it can be used to create new services or delete existing services
source :
Category : Tech

About admin

I am the owner of the website, my purpose is to bring all the most useful information to users.

Check Also


Manage participants in a zoom meeting webinar

Call the people who attend the meet as follows Alternate host host Who scheduled the …

Leave a Reply

Your email address will not be published.