23 lines
605 B
C#
23 lines
605 B
C#
#if NET461
|
|
using System.Threading.Tasks;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
using Microsoft.Extensions.Hosting;
|
|
|
|
namespace GenericHostSample
|
|
{
|
|
public class ServiceBaseControlled
|
|
{
|
|
public static async Task Main(string[] args)
|
|
{
|
|
var builder = new HostBuilder()
|
|
.ConfigureServices((hostContext, services) =>
|
|
{
|
|
services.AddHostedService<MyServiceA>();
|
|
services.AddHostedService<MyServiceB>();
|
|
});
|
|
|
|
await builder.RunAsServiceAsync();
|
|
}
|
|
}
|
|
}
|
|
#endif |