Skip to content

Commit 6c0a06f

Browse files
committed
Implemented #2 - needs some updates, does not run with latest LTS ASP core 3.1
1 parent 7751e2b commit 6c0a06f

File tree

2 files changed

+14
-13
lines changed

2 files changed

+14
-13
lines changed

Startup.cs

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
using Microsoft.Extensions.DependencyInjection;
99
using Microsoft.Extensions.Logging;
1010
using Microsoft.Extensions.Options;
11+
using Microsoft.Extensions.Hosting;
1112

1213
namespace surveyjs_aspnet_mvc
1314
{
@@ -28,26 +29,30 @@ public void ConfigureServices(IServiceCollection services)
2829
// Adds a default in-memory implementation of IDistributedCache.
2930
services.AddDistributedMemoryCache();
3031

31-
services.AddSession(options =>
32-
{
32+
services.AddSession(options => {
3333
// Set a short timeout for easy testing.
3434
options.IdleTimeout = TimeSpan.FromSeconds(300);
3535
options.Cookie.HttpOnly = true;
3636
});
37+
3738
}
3839

3940
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
40-
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
41+
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
4142
{
42-
if (env.IsDevelopment())
43-
{
43+
if (env.IsDevelopment()) {
4444
app.UseDeveloperExceptionPage();
4545
}
4646

4747
app.UseSession();
48-
app.UseMvc();
48+
app.UseRouting();
4949
app.UseDefaultFiles();
5050
app.UseStaticFiles();
51+
52+
app.UseEndpoints(endpoints => {
53+
endpoints.MapControllers();
54+
});
55+
5156
}
5257
}
5358
}

surveyjs-aspnet-mvc.csproj

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,15 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
22

33
<PropertyGroup>
4-
<TargetFramework>netcoreapp2.1</TargetFramework>
4+
<TargetFramework>netcoreapp3.1</TargetFramework>
55
</PropertyGroup>
66

77
<ItemGroup>
88
<Folder Include="wwwroot\" />
99
</ItemGroup>
1010

1111
<ItemGroup>
12-
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.1.5" />
13-
</ItemGroup>
14-
15-
<ItemGroup>
16-
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.0" />
17-
</ItemGroup>
12+
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.1.7" />
13+
</ItemGroup>
1814

1915
</Project>

0 commit comments

Comments
 (0)