2019-07-23 22:38:49 +02:00
|
|
|
|
using Bit.Core.Utilities;
|
|
|
|
|
using Microsoft.AspNetCore;
|
2018-03-21 17:57:43 +01:00
|
|
|
|
using Microsoft.AspNetCore.Hosting;
|
2019-07-23 22:38:49 +02:00
|
|
|
|
using Serilog.Events;
|
2018-03-21 17:57:43 +01:00
|
|
|
|
|
|
|
|
|
namespace Bit.Admin
|
|
|
|
|
{
|
|
|
|
|
public class Program
|
|
|
|
|
{
|
|
|
|
|
public static void Main(string[] args)
|
|
|
|
|
{
|
|
|
|
|
WebHost
|
|
|
|
|
.CreateDefaultBuilder(args)
|
2019-10-01 14:57:56 +02:00
|
|
|
|
.ConfigureKestrel(o =>
|
|
|
|
|
{
|
|
|
|
|
o.Limits.MaxRequestLineSize = 20_000;
|
|
|
|
|
})
|
2018-03-21 17:57:43 +01:00
|
|
|
|
.UseStartup<Startup>()
|
2019-07-23 22:38:49 +02:00
|
|
|
|
.ConfigureLogging((hostingContext, logging) =>
|
2019-09-04 18:54:19 +02:00
|
|
|
|
logging.AddSerilog(hostingContext, e =>
|
|
|
|
|
{
|
|
|
|
|
var context = e.Properties["SourceContext"].ToString();
|
|
|
|
|
if(e.Properties.ContainsKey("RequestPath") &&
|
|
|
|
|
!string.IsNullOrWhiteSpace(e.Properties["RequestPath"]?.ToString()) &&
|
|
|
|
|
(context.Contains(".Server.Kestrel") || context.Contains(".Core.IISHttpServer")))
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
return e.Level >= LogEventLevel.Error;
|
|
|
|
|
}))
|
2018-03-21 17:57:43 +01:00
|
|
|
|
.Build()
|
|
|
|
|
.Run();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|