From ea4e2ad3a6762f97bb1e12519bf062c06efacd1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enes=20Sad=C4=B1k=20=C3=96zbek?= Date: Thu, 26 Sep 2019 18:10:51 +0300 Subject: [PATCH] Update to ASP.NET Core 3 --- Dockerfile | 5 +---- src/Startup.cs | 19 ++++++++++++------- src/SteamOpenIdConnectProxy.csproj | 17 +++++++++++------ 3 files changed, 24 insertions(+), 17 deletions(-) diff --git a/Dockerfile b/Dockerfile index beff352..bb33d57 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,3 @@ -FROM mcr.microsoft.com/dotnet/core/aspnet:2.2-stretch-slim AS base -WORKDIR /app - FROM mcr.microsoft.com/dotnet/core/sdk:2.2-stretch AS build WORKDIR /src COPY ["src/SteamOpenIdConnectProxy.csproj", "SteamOpenIdConnectProxy/"] @@ -12,7 +9,7 @@ RUN dotnet build "SteamOpenIdConnectProxy.csproj" -c Release -o /app FROM build AS publish RUN dotnet publish "SteamOpenIdConnectProxy.csproj" -c Release -o /app -FROM base AS final +FROM bmcr.microsoft.com/dotnet/core/aspnet:3.0 AS base WORKDIR /app COPY --from=publish /app . ENTRYPOINT ["dotnet", "SteamOpenIdConnectProxy.dll"] \ No newline at end of file diff --git a/src/Startup.cs b/src/Startup.cs index 9944d00..9e62441 100644 --- a/src/Startup.cs +++ b/src/Startup.cs @@ -5,6 +5,7 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; namespace SteamOpenIdConnectProxy { @@ -20,11 +21,12 @@ namespace SteamOpenIdConnectProxy // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { - services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2); + services.AddControllers() + .AddNewtonsoftJson() + .SetCompatibilityVersion(CompatibilityVersion.Version_3_0); - services.AddDbContext(options => - options.UseInMemoryDatabase("default") - ); + services.AddDbContext(options => + options.UseInMemoryDatabase("default")); services.AddIdentity() .AddEntityFrameworkStores() @@ -47,16 +49,19 @@ namespace SteamOpenIdConnectProxy }); } - // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. - public void Configure(IApplicationBuilder app, IHostingEnvironment env) + public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } + app.UseRouting(); app.UseIdentityServer(); - app.UseMvc(); + app.UseEndpoints(endpoints => + { + endpoints.MapControllers(); + }); } } } diff --git a/src/SteamOpenIdConnectProxy.csproj b/src/SteamOpenIdConnectProxy.csproj index 89e73ff..d39c558 100644 --- a/src/SteamOpenIdConnectProxy.csproj +++ b/src/SteamOpenIdConnectProxy.csproj @@ -1,21 +1,26 @@  - netcoreapp2.2 + netcoreapp3.0 InProcess 9f8cb9ce-f696-422f-901a-563af9413684 - + - - + + + + + - + + + - +