forked from CodeMazeBlog/CodeMazeGuides
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
39 lines (27 loc) · 1.03 KB
/
Copy pathProgram.cs
File metadata and controls
39 lines (27 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
using AccountOwnerServer.Extensions;
using Microsoft.AspNetCore.HttpOverrides;
using NLog.Web;
var builder = WebApplication.CreateBuilder(args);
// NLog is registered as a logging provider, so ILogger<T> reaches the file targets in
// nlog.config as well as ILoggerManager. NLog finds nlog.config in the output directory
// on its own; there is nothing to load by hand.
builder.Logging.ClearProviders();
builder.Host.UseNLog();
builder.Services.ConfigureCors();
builder.Services.ConfigureLoggerService();
builder.Services.AddControllers();
var app = builder.Build();
// Configure the HTTP request pipeline.
// UseForwardedHeaders goes first: every component after it has to see the client's
// scheme and address, not the proxy's, or an HTTPS redirect behind a proxy loops.
app.UseForwardedHeaders(new ForwardedHeadersOptions
{
ForwardedHeaders = ForwardedHeaders.All
});
if (!app.Environment.IsDevelopment())
app.UseHsts();
app.UseHttpsRedirection();
app.UseCors("CorsPolicy");
app.UseAuthorization();
app.MapControllers();
app.Run();