static void Main(string[] args) { ServiceHost.CreateBuilder(args) .ConfigApp(e => e.AddJsonFile("appsettings.json")) .UserStartUp <StartUp>() .Build() .Run(e => e["sysname"]); }