This commit is contained in:
2018-07-05 17:07:29 +00:00
parent 877637f1e5
commit ba28bedd7d
2 changed files with 13 additions and 2 deletions

View File

@@ -24,7 +24,7 @@ namespace GZTW.Pecklist
.UseSetting("detailedErrors", "true") .UseSetting("detailedErrors", "true")
.UseKestrel() .UseKestrel()
.UseContentRoot(System.IO.Directory.GetCurrentDirectory()) .UseContentRoot(System.IO.Directory.GetCurrentDirectory())
.UseIISIntegration() //.UseIISIntegration()
.UseStartup<Startup>() .UseStartup<Startup>()
.Build(); .Build();
} }

View File

@@ -4,6 +4,7 @@ using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.HttpOverrides;
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
@@ -16,6 +17,7 @@ using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.IdentityModel.Tokens; using Microsoft.IdentityModel.Tokens;
using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Authentication;
namespace GZTW.Pecklist namespace GZTW.Pecklist
{ {
public class Startup public class Startup
@@ -44,6 +46,8 @@ namespace GZTW.Pecklist
services.AddMvc(); services.AddMvc();
//get the key from the appsettings.json file //get the key from the appsettings.json file
var secretKey = Configuration.GetSection("JWT").GetValue<string>("secret"); var secretKey = Configuration.GetSection("JWT").GetValue<string>("secret");
var signingKey = new SymmetricSecurityKey(System.Text.Encoding.ASCII.GetBytes(secretKey)); var signingKey = new SymmetricSecurityKey(System.Text.Encoding.ASCII.GetBytes(secretKey));
@@ -85,8 +89,14 @@ namespace GZTW.Pecklist
loggerFactory.AddConsole(Configuration.GetSection("Logging")); loggerFactory.AddConsole(Configuration.GetSection("Logging"));
loggerFactory.AddDebug(); loggerFactory.AddDebug();
app.UseForwardedHeaders(new ForwardedHeadersOptions
{
ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto
});
app.UseDefaultFiles(); app.UseDefaultFiles();
app.UseStaticFiles(new StaticFileOptions app.UseStaticFiles(new StaticFileOptions
{ {
OnPrepareResponse = context => OnPrepareResponse = context =>
{ {
@@ -97,6 +107,7 @@ namespace GZTW.Pecklist
} }
} }
}); });
app.UseAuthentication(); app.UseAuthentication();
app.UseMvc(); app.UseMvc();