return ocelote to 2.2 for incompatibility of 3.0

This commit is contained in:
Erik Pique 2019-08-02 12:26:13 +02:00
parent cb942598c8
commit 1c88396c99
4 changed files with 21 additions and 24 deletions

View File

@ -1,19 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk.Web"> <Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup> <PropertyGroup>
<TargetFramework>$(NetCoreTargetVersion)</TargetFramework> <TargetFramework>netcoreapp2.2</TargetFramework>
<LangVersion>$(LangVersion)</LangVersion> <LangVersion>$(LangVersion)</LangVersion>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="AspNetCore.HealthChecks.UI.Client" Version="$(AspNetCore_HealthChecks_UI_Client)" /> <PackageReference Include="AspNetCore.HealthChecks.UI.Client" Version="2.2.2" />
<PackageReference Include="AspNetCore.HealthChecks.Uris" Version="$(AspNetCore_HealthChecks_Uris)" /> <PackageReference Include="AspNetCore.HealthChecks.Uris" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.HealthChecks" Version="$(Microsoft_AspNetCore_Diagnostics_HealthChecks)" /> <PackageReference Include="Microsoft.AspNetCore.App" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.HealthChecks" Version="$(Microsoft_AspNetCore_HealthChecks)" /> <PackageReference Include="Microsoft.AspNetCore.Diagnostics.HealthChecks" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Formatters.Json" Version="$(Microsoft_AspNetCore_Mvc_Formatters_Json)" /> <PackageReference Include="Microsoft.AspNetCore.HealthChecks" Version="1.0.0" />
<PackageReference Include="Ocelot" Version="$(Ocelot)" /> <PackageReference Include="Ocelot" Version="12.0.1" />
<PackageReference Include="Serilog.AspNetCore" Version="$(Serilog_AspNetCore)" /> <PackageReference Include="Serilog.AspNetCore" Version="2.1.1" />
<PackageReference Include="Serilog.Sinks.Console" Version="$(Serilog_Sinks_Console)" /> <PackageReference Include="Serilog.Sinks.Console" Version="3.1.1" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="$(Microsoft_AspNetCore_Authentication_JwtBearer)" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -89,19 +89,15 @@ namespace OcelotApiGw
app.UseDeveloperExceptionPage(); app.UseDeveloperExceptionPage();
} }
app.UseRouting(); app.UseHealthChecks("/hc", new HealthCheckOptions()
app.UseEndpoints(endpoints =>
{ {
endpoints.MapControllers(); Predicate = _ => true,
endpoints.MapHealthChecks("/hc", new HealthCheckOptions() ResponseWriter = UIResponseWriter.WriteHealthCheckUIResponse
{ });
Predicate = _ => true,
ResponseWriter = UIResponseWriter.WriteHealthCheckUIResponse app.UseHealthChecks("/liveness", new HealthCheckOptions
}); {
endpoints.MapHealthChecks("/liveness", new HealthCheckOptions Predicate = r => r.Name.Contains("self")
{
Predicate = r => r.Name.Contains("self")
});
}); });
app.UseCors("CorsPolicy"); app.UseCors("CorsPolicy");

View File

@ -50,7 +50,7 @@ namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator
.AddDevspaces() .AddDevspaces()
.AddHttpServices(); .AddHttpServices();
services.AddControllers(); services.AddControllers().AddNewtonsoftJson();
} }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. // 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.UseHttpsRedirection();
app.UseRouting(); app.UseRouting();
app.UseAuthentication(); app.UseAuthentication();
app.UseAuthorization();
app.UseEndpoints(endpoints => app.UseEndpoints(endpoints =>
{ {
endpoints.MapDefaultControllerRoute(); endpoints.MapDefaultControllerRoute();

View File

@ -51,7 +51,7 @@ namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator
.AddDevspaces() .AddDevspaces()
.AddApplicationServices(); .AddApplicationServices();
services.AddControllers(); services.AddControllers().AddNewtonsoftJson();
} }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. // 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.UseAuthentication();
app.UseAuthorization();
app.UseHttpsRedirection(); app.UseHttpsRedirection();
app.UseRouting(); app.UseRouting();
app.UseEndpoints(endpoints => app.UseEndpoints(endpoints =>