Update to ASP.NET Core 3

This commit is contained in:
Enes Sadık Özbek 2019-09-26 18:10:51 +03:00
parent 9938d014a7
commit ea4e2ad3a6
3 changed files with 24 additions and 17 deletions

View file

@ -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"]

View file

@ -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<AppInMemoryDbContext>(options =>
options.UseInMemoryDatabase("default")
);
services.AddDbContext<AppInMemoryDbContext>(options =>
options.UseInMemoryDatabase("default"));
services.AddIdentity<IdentityUser, IdentityRole>()
.AddEntityFrameworkStores<AppInMemoryDbContext>()
@ -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();
});
}
}
}

View file

@ -1,21 +1,26 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
<TargetFramework>netcoreapp3.0</TargetFramework>
<AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
<UserSecretsId>9f8cb9ce-f696-422f-901a-563af9413684</UserSecretsId>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="AspNet.Security.OpenId.Steam" Version="2.0.0" />
<PackageReference Include="AspNet.Security.OpenId.Steam" Version="2.1.0" />
<PackageReference Include="AspNet.Security.OpenIdConnect.Server" Version="2.0.0" />
<PackageReference Include="IdentityServer4" Version="2.4.0" />
<PackageReference Include="IdentityServer4.AspNetIdentity" Version="2.4.0" />
<PackageReference Include="IdentityServer4" Version="3.0.1" />
<PackageReference Include="IdentityServer4.AspNetIdentity" Version="3.0.1" />
<PackageReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="Microsoft.AspNetCore.Identity" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="3.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="2.2.0" PrivateAssets="All" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.2.3" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="3.0.0" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.0.0" />
<PackageReference Include="Serilog" Version="2.8.0" />
<PackageReference Include="Serilog.AspNetCore" Version="2.1.1" />
<PackageReference Include="Serilog.AspNetCore" Version="3.0.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="3.1.1" />
</ItemGroup>