A
Anitta Puthussery
Guest
Hi,
I have created a worker service in .net core 3.1. To run worker as window service , added the Microsoft.Extensions.Hosting.WindowsServices NuGet package and changed code as below.
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.UseWindowsService() // worker as window service
.ConfigureServices((hostContext, services) =>
{
services.AddHostedService<Worker>();
});
Then created service using command prompt :
sc create rmmService binpath =C:\Users\Admin\source\repos\WorkerService2\WorkerSetup2\Debug\setup.exe
But I need to create msi package for the same project . That means while installing msi package ,the service should be installed automatically.
Continue reading...
I have created a worker service in .net core 3.1. To run worker as window service , added the Microsoft.Extensions.Hosting.WindowsServices NuGet package and changed code as below.
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.UseWindowsService() // worker as window service
.ConfigureServices((hostContext, services) =>
{
services.AddHostedService<Worker>();
});
Then created service using command prompt :
sc create rmmService binpath =C:\Users\Admin\source\repos\WorkerService2\WorkerSetup2\Debug\setup.exe
But I need to create msi package for the same project . That means while installing msi package ,the service should be installed automatically.
Continue reading...