using System; using System.Collections.Generic; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Logging; using MQTTnet.AspNetCore; using WalkingTec.Mvvm.Core; using NLog; using NLog.Web; namespace IoTGateway { public class Program { public static void Main(string[] args) { Console.WriteLine(@" ██╗ ██████╗ ████████╗ ██████╗ █████╗ ████████╗███████╗██╗ ██╗ █████╗ ██╗ ██╗ ██║██╔═══██╗╚══██╔══╝██╔════╝ ██╔══██╗╚══██╔══╝██╔════╝██║ ██║██╔══██╗╚██╗ ██╔╝ ██║██║ ██║ ██║ ██║ ███╗███████║ ██║ █████╗ ██║ █╗ ██║███████║ ╚████╔╝ ██║██║ ██║ ██║ ██║ ██║██╔══██║ ██║ ██╔══╝ ██║███╗██║██╔══██║ ╚██╔╝ ██║╚██████╔╝ ██║ ╚██████╔╝██║ ██║ ██║ ███████╗╚███╔███╔╝██║ ██║ ██║ ╚═╝ ╚═════╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝ ╚═╝ ╚══════╝ ╚══╝╚══╝ ╚═╝ ╚═╝ ╚═╝ "); CreateWebHostBuilder(args).Build().Run(); } public static IHostBuilder CreateWebHostBuilder(string[] args) { return Host.CreateDefaultBuilder(args) .ConfigureAppConfiguration((hostingContext, config) => { config.AddInMemoryCollection(new Dictionary { { "HostRoot", hostingContext.HostingEnvironment.ContentRootPath } }); }) .ConfigureLogging((hostingContext, logging) => { logging.ClearProviders(); logging.AddConsole(); logging.AddWTMLogger(); }) .ConfigureWebHostDefaults(webBuilder => { webBuilder.UseStartup(); webBuilder.UseKestrel(option => { option.ListenAnyIP(1888, l => l.UseMqtt()); option.ListenAnyIP(518); }); }) .UseNLog(); } } }