ASCU_ALL/ApiServer/Program.cs

52 lines
1.4 KiB
C#
Raw Normal View History

2021-07-30 14:49:24 +05:00
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Hosting;
2021-07-31 22:27:59 +05:00
using NLog;
using NLog.Config;
using NLog.Targets;
2021-07-30 14:49:24 +05:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace ApiServer
{
public class Program
{
public static void Main(string[] args)
{
2021-07-31 22:27:59 +05:00
LogConf();
2021-07-30 14:49:24 +05:00
CreateHostBuilder(args).Build().Run();
}
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseUrls("http://*:64400/");
2021-07-31 22:27:59 +05:00
//webBuilder.UseUrls("http://127.0.0.1:5000/");
webBuilder.UseStartup<Startup>();
2021-08-06 10:39:28 +05:00
webBuilder.UseKestrel(options =>
{
options.Limits.MaxRequestBodySize = long.MaxValue;
options.Limits.MaxRequestBufferSize = long.MaxValue;
options.Limits.MaxRequestLineSize = int.MaxValue;
options.Limits.MaxResponseBufferSize = long.MaxValue;
});
2021-07-30 14:49:24 +05:00
});
2021-07-31 22:27:59 +05:00
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;
}
2021-07-30 14:49:24 +05:00
}
}