fix routing
This commit is contained in:
parent
5f9a1b8b8f
commit
8b0ec9038f
@ -49,17 +49,6 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API
|
||||
{
|
||||
RegisterAppInsights(services);
|
||||
|
||||
// Add framework services.
|
||||
//services.AddMvc(options =>
|
||||
// {
|
||||
// options.Filters.Add(typeof(HttpGlobalExceptionFilter));
|
||||
// options.Filters.Add(typeof(ValidateModelStateFilter));
|
||||
|
||||
// })
|
||||
// .AddNewtonsoftJson()
|
||||
// .SetCompatibilityVersion(CompatibilityVersion.Version_3_0)
|
||||
// .AddControllersAsServices();
|
||||
|
||||
services.AddControllers(options =>
|
||||
{
|
||||
options.Filters.Add(typeof(HttpGlobalExceptionFilter));
|
||||
@ -204,10 +193,12 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API
|
||||
|
||||
ConfigureAuth(app);
|
||||
|
||||
app.UseAuthorization();
|
||||
app.UseRouting();
|
||||
app.UseEndpoints(endpoints =>
|
||||
{
|
||||
endpoints.MapDefaultControllerRoute();
|
||||
endpoints.MapControllers();
|
||||
endpoints.MapHealthChecks("/hc", new HealthCheckOptions()
|
||||
{
|
||||
Predicate = _ => true,
|
||||
|
@ -55,8 +55,6 @@ namespace Microsoft.eShopOnContainers.Services.Catalog.API
|
||||
.AddSwagger()
|
||||
.AddCustomHealthCheck(Configuration);
|
||||
|
||||
services.AddControllers();
|
||||
|
||||
var container = new ContainerBuilder();
|
||||
container.Populate(services);
|
||||
|
||||
@ -139,11 +137,13 @@ namespace Microsoft.eShopOnContainers.Services.Catalog.API
|
||||
public static IServiceCollection AddCustomMVC(this IServiceCollection services, IConfiguration configuration)
|
||||
{
|
||||
services.AddMvc(options =>
|
||||
{
|
||||
options.Filters.Add(typeof(HttpGlobalExceptionFilter));
|
||||
})
|
||||
.SetCompatibilityVersion(CompatibilityVersion.Version_3_0)
|
||||
.AddControllersAsServices();
|
||||
{
|
||||
options.Filters.Add(typeof(HttpGlobalExceptionFilter));
|
||||
})
|
||||
.SetCompatibilityVersion(CompatibilityVersion.Version_3_0)
|
||||
.AddControllersAsServices();
|
||||
|
||||
services.AddControllers();
|
||||
|
||||
services.AddCors(options =>
|
||||
{
|
||||
|
@ -51,7 +51,11 @@ namespace Microsoft.eShopOnContainers.Services.Locations.API
|
||||
.SetCompatibilityVersion(CompatibilityVersion.Version_3_0)
|
||||
.AddControllersAsServices();
|
||||
|
||||
services.AddControllers();
|
||||
services.AddControllers(options =>
|
||||
{
|
||||
options.Filters.Add(typeof(HttpGlobalExceptionFilter));
|
||||
|
||||
}).AddNewtonsoftJson();
|
||||
|
||||
ConfigureAuthService(services);
|
||||
|
||||
|
@ -23,7 +23,6 @@
|
||||
using Marketing.API.IntegrationEvents.Handlers;
|
||||
using Microsoft.AspNetCore.Authentication.JwtBearer;
|
||||
using Microsoft.AspNetCore.Diagnostics.HealthChecks;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore.Diagnostics;
|
||||
using Microsoft.eShopOnContainers.Services.Marketing.API.Infrastructure.Middlewares;
|
||||
using Microsoft.Extensions.Diagnostics.HealthChecks;
|
||||
@ -50,15 +49,7 @@
|
||||
RegisterAppInsights(services);
|
||||
|
||||
// Add framework services.
|
||||
services
|
||||
.AddCustomHealthCheck(Configuration)
|
||||
.AddMvc(options =>
|
||||
{
|
||||
options.Filters.Add(typeof(HttpGlobalExceptionFilter));
|
||||
})
|
||||
.SetCompatibilityVersion(CompatibilityVersion.Version_3_0)
|
||||
.AddControllersAsServices(); //Injecting Controllers themselves thru DIFor further info see: http://docs.autofac.org/en/latest/integration/aspnetcore.html#controllers-as-services
|
||||
|
||||
services.AddCustomHealthCheck(Configuration);
|
||||
services.AddControllers();
|
||||
services.Configure<MarketingSettings>(Configuration);
|
||||
|
||||
@ -198,10 +189,12 @@
|
||||
|
||||
ConfigureAuth(app);
|
||||
|
||||
app.UseAuthorization();
|
||||
app.UseRouting();
|
||||
app.UseEndpoints(endpoints =>
|
||||
{
|
||||
endpoints.MapDefaultControllerRoute();
|
||||
endpoints.MapControllers();
|
||||
endpoints.MapHealthChecks("/hc", new HealthCheckOptions()
|
||||
{
|
||||
Predicate = _ => true,
|
||||
|
@ -72,7 +72,7 @@
|
||||
<Microsoft_EntityFrameworkCore_SqlServer>3.0.0-preview7.19362.6</Microsoft_EntityFrameworkCore_SqlServer>
|
||||
<Microsoft_EntityFrameworkCore_Design>3.0.0-preview7.19362.6</Microsoft_EntityFrameworkCore_Design>
|
||||
<Microsoft_Extensions_Identity_Stores>3.0.0-preview7.19365.7</Microsoft_Extensions_Identity_Stores>
|
||||
<Microsoft_Extensions_Configuration_AzureKeyVault>2.2.0</Microsoft_Extensions_Configuration_AzureKeyVault>
|
||||
<Microsoft_Extensions_Configuration_AzureKeyVault>3.0.0-preview7.19362.4</Microsoft_Extensions_Configuration_AzureKeyVault>
|
||||
<Microsoft_Extensions_DependencyInjection_Abstractions>2.2.0</Microsoft_Extensions_DependencyInjection_Abstractions>
|
||||
<Microsoft_Extensions_Diagnostics_HealthChecks>2.2.0</Microsoft_Extensions_Diagnostics_HealthChecks>
|
||||
<Microsoft_Extensions_Http>2.2.0</Microsoft_Extensions_Http>
|
||||
|
Loading…
x
Reference in New Issue
Block a user