From 1c88396c99f12836eb47f3d993434f1ff784fca7 Mon Sep 17 00:00:00 2001 From: Erik Pique <epique@plainconcepts.com> Date: Fri, 2 Aug 2019 12:26:13 +0200 Subject: [PATCH] return ocelote to 2.2 for incompatibility of 3.0 --- src/ApiGateways/ApiGw-Base/OcelotApiGw.csproj | 19 +++++++++--------- src/ApiGateways/ApiGw-Base/Startup.cs | 20 ++++++++----------- .../Mobile.Bff.Shopping/aggregator/Startup.cs | 3 ++- .../Web.Bff.Shopping/aggregator/Startup.cs | 3 ++- 4 files changed, 21 insertions(+), 24 deletions(-) diff --git a/src/ApiGateways/ApiGw-Base/OcelotApiGw.csproj b/src/ApiGateways/ApiGw-Base/OcelotApiGw.csproj index eb2eacb0a..442fa36a3 100644 --- a/src/ApiGateways/ApiGw-Base/OcelotApiGw.csproj +++ b/src/ApiGateways/ApiGw-Base/OcelotApiGw.csproj @@ -1,19 +1,18 @@ <Project Sdk="Microsoft.NET.Sdk.Web"> <PropertyGroup> - <TargetFramework>$(NetCoreTargetVersion)</TargetFramework> + <TargetFramework>netcoreapp2.2</TargetFramework> <LangVersion>$(LangVersion)</LangVersion> </PropertyGroup> <ItemGroup> - <PackageReference Include="AspNetCore.HealthChecks.UI.Client" Version="$(AspNetCore_HealthChecks_UI_Client)" /> - <PackageReference Include="AspNetCore.HealthChecks.Uris" Version="$(AspNetCore_HealthChecks_Uris)" /> - <PackageReference Include="Microsoft.AspNetCore.Diagnostics.HealthChecks" Version="$(Microsoft_AspNetCore_Diagnostics_HealthChecks)" /> - <PackageReference Include="Microsoft.AspNetCore.HealthChecks" Version="$(Microsoft_AspNetCore_HealthChecks)" /> - <PackageReference Include="Microsoft.AspNetCore.Mvc.Formatters.Json" Version="$(Microsoft_AspNetCore_Mvc_Formatters_Json)" /> - <PackageReference Include="Ocelot" Version="$(Ocelot)" /> - <PackageReference Include="Serilog.AspNetCore" Version="$(Serilog_AspNetCore)" /> - <PackageReference Include="Serilog.Sinks.Console" Version="$(Serilog_Sinks_Console)" /> - <PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="$(Microsoft_AspNetCore_Authentication_JwtBearer)" /> + <PackageReference Include="AspNetCore.HealthChecks.UI.Client" Version="2.2.2" /> + <PackageReference Include="AspNetCore.HealthChecks.Uris" Version="2.2.0" /> + <PackageReference Include="Microsoft.AspNetCore.App" Version="2.2.0" /> + <PackageReference Include="Microsoft.AspNetCore.Diagnostics.HealthChecks" Version="2.2.0" /> + <PackageReference Include="Microsoft.AspNetCore.HealthChecks" Version="1.0.0" /> + <PackageReference Include="Ocelot" Version="12.0.1" /> + <PackageReference Include="Serilog.AspNetCore" Version="2.1.1" /> + <PackageReference Include="Serilog.Sinks.Console" Version="3.1.1" /> </ItemGroup> </Project> diff --git a/src/ApiGateways/ApiGw-Base/Startup.cs b/src/ApiGateways/ApiGw-Base/Startup.cs index 8d52851b4..be845edca 100644 --- a/src/ApiGateways/ApiGw-Base/Startup.cs +++ b/src/ApiGateways/ApiGw-Base/Startup.cs @@ -89,19 +89,15 @@ namespace OcelotApiGw app.UseDeveloperExceptionPage(); } - app.UseRouting(); - app.UseEndpoints(endpoints => + app.UseHealthChecks("/hc", new HealthCheckOptions() { - endpoints.MapControllers(); - endpoints.MapHealthChecks("/hc", new HealthCheckOptions() - { - Predicate = _ => true, - ResponseWriter = UIResponseWriter.WriteHealthCheckUIResponse - }); - endpoints.MapHealthChecks("/liveness", new HealthCheckOptions - { - Predicate = r => r.Name.Contains("self") - }); + Predicate = _ => true, + ResponseWriter = UIResponseWriter.WriteHealthCheckUIResponse + }); + + app.UseHealthChecks("/liveness", new HealthCheckOptions + { + Predicate = r => r.Name.Contains("self") }); app.UseCors("CorsPolicy"); diff --git a/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Startup.cs b/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Startup.cs index 986973f93..602477dde 100644 --- a/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Startup.cs +++ b/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Startup.cs @@ -50,7 +50,7 @@ namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator .AddDevspaces() .AddHttpServices(); - services.AddControllers(); + services.AddControllers().AddNewtonsoftJson(); } // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. @@ -79,6 +79,7 @@ namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator app.UseHttpsRedirection(); app.UseRouting(); app.UseAuthentication(); + app.UseAuthorization(); app.UseEndpoints(endpoints => { endpoints.MapDefaultControllerRoute(); diff --git a/src/ApiGateways/Web.Bff.Shopping/aggregator/Startup.cs b/src/ApiGateways/Web.Bff.Shopping/aggregator/Startup.cs index 0b7790e36..257334aa3 100644 --- a/src/ApiGateways/Web.Bff.Shopping/aggregator/Startup.cs +++ b/src/ApiGateways/Web.Bff.Shopping/aggregator/Startup.cs @@ -51,7 +51,7 @@ namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator .AddDevspaces() .AddApplicationServices(); - services.AddControllers(); + services.AddControllers().AddNewtonsoftJson(); } // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. @@ -77,6 +77,7 @@ namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator } app.UseAuthentication(); + app.UseAuthorization(); app.UseHttpsRedirection(); app.UseRouting(); app.UseEndpoints(endpoints =>