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