|
|
@ -1,6 +1,7 @@ |
|
|
|
using Autofac; |
|
|
|
using Autofac.Extensions.DependencyInjection; |
|
|
|
using HealthChecks.UI.Client; |
|
|
|
using Locations.API.Controllers; |
|
|
|
using Microsoft.AspNetCore.Authentication.JwtBearer; |
|
|
|
using Microsoft.AspNetCore.Builder; |
|
|
|
using Microsoft.AspNetCore.Diagnostics.HealthChecks; |
|
|
@ -37,17 +38,18 @@ namespace Microsoft.eShopOnContainers.Services.Locations.API |
|
|
|
|
|
|
|
public IConfiguration Configuration { get; } |
|
|
|
|
|
|
|
public IServiceProvider ConfigureServices(IServiceCollection services) |
|
|
|
public virtual IServiceProvider ConfigureServices(IServiceCollection services) |
|
|
|
{ |
|
|
|
RegisterAppInsights(services); |
|
|
|
|
|
|
|
services.AddCustomHealthCheck(Configuration); |
|
|
|
|
|
|
|
services.AddControllers(options => |
|
|
|
{ |
|
|
|
options.Filters.Add(typeof(HttpGlobalExceptionFilter)); |
|
|
|
|
|
|
|
}).AddNewtonsoftJson(); |
|
|
|
{ |
|
|
|
options.Filters.Add(typeof(HttpGlobalExceptionFilter)); |
|
|
|
}) |
|
|
|
.AddApplicationPart(typeof(LocationsController).Assembly) |
|
|
|
.AddNewtonsoftJson(); |
|
|
|
|
|
|
|
ConfigureAuthService(services); |
|
|
|
|
|
|
@ -154,7 +156,7 @@ namespace Microsoft.eShopOnContainers.Services.Locations.API |
|
|
|
} |
|
|
|
|
|
|
|
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
|
|
|
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) |
|
|
|
public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerFactory loggerFactory) |
|
|
|
{ |
|
|
|
//loggerFactory.AddAzureWebAppDiagnostics();
|
|
|
|
//loggerFactory.AddApplicationInsights(app.ApplicationServices, LogLevel.Trace);
|
|
|
@ -167,9 +169,9 @@ namespace Microsoft.eShopOnContainers.Services.Locations.API |
|
|
|
|
|
|
|
app.UseCors("CorsPolicy"); |
|
|
|
|
|
|
|
app.UseRouting(); |
|
|
|
ConfigureAuth(app); |
|
|
|
|
|
|
|
app.UseRouting(); |
|
|
|
app.UseEndpoints(endpoints => |
|
|
|
{ |
|
|
|
endpoints.MapDefaultControllerRoute(); |
|
|
|