using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Hosting; using NLog; using NLog.Config; using NLog.Targets; using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; namespace ApiServer { public class Program { public static void Main(string[] args) { LogConf(); CreateHostBuilder(args).Build().Run(); } public static IHostBuilder CreateHostBuilder(string[] args) => Host.CreateDefaultBuilder(args) .ConfigureWebHostDefaults(webBuilder => { webBuilder.UseUrls("http://*:64400/"); //webBuilder.UseUrls("http://127.0.0.1:5000/"); webBuilder.UseStartup(); webBuilder.UseKestrel(options => { options.Limits.MaxRequestBodySize = long.MaxValue; options.Limits.MaxRequestBufferSize = long.MaxValue; options.Limits.MaxRequestLineSize = int.MaxValue; options.Limits.MaxResponseBufferSize = long.MaxValue; }); }); static void LogConf() { var conf = new LoggingConfiguration(); var logcon = new ConsoleTarget() { Name = "logcon", Layout = @"${time}|${level:uppercase=true}|${logger}|${message}${when:when=length('${exception}')>0:Inner=|}${exception:format=ToString,StackTrace}" }; conf.AddRule(LogLevel.Trace, LogLevel.Fatal, logcon); LogManager.Configuration = conf; } } }