File tree Expand file tree Collapse file tree 2 files changed +14
-13
lines changed
Expand file tree Collapse file tree 2 files changed +14
-13
lines changed Original file line number Diff line number Diff line change 88using Microsoft . Extensions . DependencyInjection ;
99using Microsoft . Extensions . Logging ;
1010using Microsoft . Extensions . Options ;
11+ using Microsoft . Extensions . Hosting ;
1112
1213namespace 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}
Original file line number Diff line number Diff line change 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 >
You can’t perform that action at this time.
0 commit comments