refactor: remove ConfigureWebApiExtensionsAtFirst extension
This commit is contained in:
parent
1f9fb4163b
commit
8190e0005a
@ -17,6 +17,7 @@ using HRD.WebApi.DAL.Middleware;
|
|||||||
using HRD.WebApi.Helpers;
|
using HRD.WebApi.Helpers;
|
||||||
using StaffDBServer.SharedControllers;
|
using StaffDBServer.SharedControllers;
|
||||||
using HRD.LDAPService;
|
using HRD.LDAPService;
|
||||||
|
using Microsoft.AspNetCore.Server.IISIntegration;
|
||||||
|
|
||||||
AppDomain.CurrentDomain.UnhandledException += (object sender, UnhandledExceptionEventArgs unhandledExceptionEventArgs) =>
|
AppDomain.CurrentDomain.UnhandledException += (object sender, UnhandledExceptionEventArgs unhandledExceptionEventArgs) =>
|
||||||
{
|
{
|
||||||
@ -41,7 +42,26 @@ try
|
|||||||
builder.Host.UseNLog();
|
builder.Host.UseNLog();
|
||||||
|
|
||||||
// Add services to the container
|
// Add services to the container
|
||||||
builder.Services.ConfigureWebApiExtensionsAtFirst(); // at first
|
// at first
|
||||||
|
//services.AddCors();
|
||||||
|
builder.Services.AddCustomCors("AllowAllOrigins");
|
||||||
|
|
||||||
|
builder.Services.Configure<IISOptions>(options =>
|
||||||
|
{
|
||||||
|
options.AuthenticationDisplayName = "Windows";
|
||||||
|
options.ForwardClientCertificate = true;
|
||||||
|
options.AutomaticAuthentication = true;
|
||||||
|
});
|
||||||
|
builder.Services.AddAuthentication(IISDefaults.AuthenticationScheme);
|
||||||
|
|
||||||
|
builder.Services.ConfigureJWT(StaffDBServer.Extends.JwtMiddlewareOptionsHelper.GetJwtMiddlewareOptions()); ;
|
||||||
|
|
||||||
|
builder.Services.ConfigureDAL(WebApiMiddlewareOptionsHelper.GetWebApiMiddlewareOptions());
|
||||||
|
|
||||||
|
builder.Services.AddSingleton<ILoggerManager, LoggerManager>();
|
||||||
|
|
||||||
|
builder.Services.ConfigureSwagger();
|
||||||
|
|
||||||
builder.Services.ConfigureRepositoryWrapper(); // add repos
|
builder.Services.ConfigureRepositoryWrapper(); // add repos
|
||||||
|
|
||||||
var cnnStr = WebApiConfig.ConnectionString(EN_ConnectionType.SQLServer);
|
var cnnStr = WebApiConfig.ConnectionString(EN_ConnectionType.SQLServer);
|
||||||
|
|||||||
@ -11,28 +11,6 @@ namespace StaffDBServer.SharedExtensions
|
|||||||
{
|
{
|
||||||
public static class ServiceExtensions
|
public static class ServiceExtensions
|
||||||
{
|
{
|
||||||
public static void ConfigureWebApiExtensionsAtFirst(this IServiceCollection services)
|
|
||||||
{
|
|
||||||
//services.AddCors();
|
|
||||||
services.AddCustomCors("AllowAllOrigins");
|
|
||||||
|
|
||||||
services.Configure<IISOptions>(options =>
|
|
||||||
{
|
|
||||||
options.AuthenticationDisplayName = "Windows";
|
|
||||||
options.ForwardClientCertificate = true;
|
|
||||||
options.AutomaticAuthentication = true;
|
|
||||||
});
|
|
||||||
services.AddAuthentication(IISDefaults.AuthenticationScheme);
|
|
||||||
|
|
||||||
services.ConfigureJWT(Extends.JwtMiddlewareOptionsHelper.GetJwtMiddlewareOptions()); ;
|
|
||||||
|
|
||||||
services.ConfigureDAL(WebApiMiddlewareOptionsHelper.GetWebApiMiddlewareOptions());
|
|
||||||
|
|
||||||
services.AddSingleton<ILoggerManager, LoggerManager>();
|
|
||||||
|
|
||||||
services.ConfigureSwagger();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void ConfigureWebApiExtensionsEnd(this IServiceCollection services)
|
public static void ConfigureWebApiExtensionsEnd(this IServiceCollection services)
|
||||||
{
|
{
|
||||||
services.AddMvc()
|
services.AddMvc()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user