Skip to content

Commit d6ff200

Browse files
Update tutorial to .NET Core 3 release (#934)
1 parent 4e42636 commit d6ff200

File tree

3 files changed

+20
-23
lines changed

3 files changed

+20
-23
lines changed

tutorial-code/Startup.cs

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
using Microsoft.AspNetCore.Http;
1010
using Microsoft.Extensions.Configuration;
1111
using Microsoft.Extensions.DependencyInjection;
12+
using Microsoft.Extensions.Hosting;
1213
using Microsoft.Extensions.Logging;
1314
using Newtonsoft.Json;
1415
using Newtonsoft.Json.Serialization;
@@ -18,7 +19,7 @@ namespace ReactDemo
1819
{
1920
public class Startup
2021
{
21-
public Startup(IHostingEnvironment env)
22+
public Startup(IWebHostEnvironment env)
2223
{
2324
var builder = new ConfigurationBuilder()
2425
.SetBasePath(env.ContentRootPath)
@@ -43,11 +44,8 @@ public void ConfigureServices(IServiceCollection services)
4344
}
4445

4546
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
46-
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
47+
public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerFactory loggerFactory)
4748
{
48-
loggerFactory.AddConsole(Configuration.GetSection("Logging"));
49-
loggerFactory.AddDebug();
50-
5149
if (env.IsDevelopment())
5250
{
5351
app.UseDeveloperExceptionPage();
@@ -85,11 +83,11 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerF
8583

8684
app.UseStaticFiles();
8785

88-
app.UseMvc(routes =>
86+
app.UseRouting();
87+
88+
app.UseEndpoints(endpoints =>
8989
{
90-
routes.MapRoute(
91-
name: "default",
92-
template: "{controller=Home}/{action=Index}/{id?}");
90+
endpoints.MapControllerRoute("default", "{controller=Home}/{action=Index}/{id?}");
9391
});
9492
}
9593
}

tutorial-code/tutorial-code.csproj

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
22
<PropertyGroup>
3-
<TargetFramework>netcoreapp2.2</TargetFramework>
3+
<TargetFramework>netcoreapp3.0</TargetFramework>
44
<PreserveCompilationContext>true</PreserveCompilationContext>
55
<AssemblyName>tutorial-code</AssemblyName>
66
<OutputType>Exe</OutputType>
@@ -14,17 +14,13 @@
1414
</ItemGroup>
1515
<ItemGroup>
1616
<PackageReference Include="JavascriptEngineSwitcher.ChakraCore" Version="3.1.8" />
17-
<PackageReference Include="JavascriptEngineSwitcher.ChakraCore.native.linux-x64" Version="3.1.8" />
18-
<PackageReference Include="JavascriptEngineSwitcher.ChakraCore.native.osx-x64" Version="3.1.8" />
19-
<PackageReference Include="JavascriptEngineSwitcher.ChakraCore.native.win-x64" Version="3.1.8" />
20-
<PackageReference Include="JavascriptEngineSwitcher.Extensions.MsDependencyInjection" Version="3.1.0" />
17+
<PackageReference Include="JavascriptEngineSwitcher.ChakraCore.native.linux-x64" Version="3.1.8" />
18+
<PackageReference Include="JavascriptEngineSwitcher.ChakraCore.native.osx-x64" Version="3.1.8" />
19+
<PackageReference Include="JavascriptEngineSwitcher.ChakraCore.native.win-x64" Version="3.1.8" />
20+
<PackageReference Include="JavascriptEngineSwitcher.Extensions.MsDependencyInjection" Version="3.1.0" />
2121
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.2.4" />
2222
<PackageReference Include="Microsoft.VisualStudio.Web.BrowserLink" Version="2.2.0" />
2323
<PackageReference Include="React.AspNet" Version="5.1.1" />
24-
<PackageReference Include="Microsoft.AspNetCore" Version="2.2.0" />
25-
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.2.0" />
26-
<PackageReference Include="Microsoft.NET.Sdk.Razor" Version="2.2.0" />
27-
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="2.2.0" />
2824
</ItemGroup>
2925
<ItemGroup>
3026
<Content Update="Views\Home\Index.cshtml">

tutorial-code/web.config

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<configuration>
3-
43
<!--
54
Configure your application settings in appsettings.json. Learn more at http://go.microsoft.com/fwlink/?LinkId=786380
65
-->
7-
86
<system.webServer>
97
<handlers>
10-
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified"/>
8+
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
119
</handlers>
12-
<aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false"/>
10+
<aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false" hostingModel="InProcess">
11+
<environmentVariables>
12+
<environmentVariable name="COMPLUS_ForceENC" value="1" />
13+
<environmentVariable name="ASPNETCORE_ENVIRONMENT" value="Development" />
14+
</environmentVariables>
15+
</aspNetCore>
1316
</system.webServer>
14-
</configuration>
17+
</configuration>

0 commit comments

Comments
 (0)