Skip to content

Commit 287a519

Browse files
Downgrade tutorial to .NETCore 2.2, since 3.0 is not released (#912)
1 parent efa667b commit 287a519

File tree

3 files changed

+29
-17
lines changed

3 files changed

+29
-17
lines changed

tutorial-code/Startup.cs

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ namespace ReactDemo
1818
{
1919
public class Startup
2020
{
21-
public Startup(IWebHostEnvironment env)
21+
public Startup(IHostingEnvironment env)
2222
{
2323
var builder = new ConfigurationBuilder()
2424
.SetBasePath(env.ContentRootPath)
@@ -43,9 +43,20 @@ public void ConfigureServices(IServiceCollection services)
4343
}
4444

4545
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
46-
public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerFactory loggerFactory)
46+
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
4747
{
48-
app.UseDeveloperExceptionPage();
48+
loggerFactory.AddConsole(Configuration.GetSection("Logging"));
49+
loggerFactory.AddDebug();
50+
51+
if (env.IsDevelopment())
52+
{
53+
app.UseDeveloperExceptionPage();
54+
app.UseBrowserLink();
55+
}
56+
else
57+
{
58+
app.UseExceptionHandler("/Home/Error");
59+
}
4960

5061
// Initialise ReactJS.NET. Must be before static files.
5162
app.UseReact(config =>
@@ -74,11 +85,11 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerF
7485

7586
app.UseStaticFiles();
7687

77-
app.UseRouting();
78-
79-
app.UseEndpoints(endpoints =>
88+
app.UseMvc(routes =>
8089
{
81-
endpoints.MapControllerRoute("default", "{controller=Home}/{action=Index}/{id?}");
90+
routes.MapRoute(
91+
name: "default",
92+
template: "{controller=Home}/{action=Index}/{id?}");
8293
});
8394
}
8495
}

tutorial-code/tutorial-code.csproj

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
22
<PropertyGroup>
3-
<TargetFramework>netcoreapp3.0</TargetFramework>
3+
<TargetFramework>netcoreapp2.2</TargetFramework>
44
<PreserveCompilationContext>true</PreserveCompilationContext>
55
<AssemblyName>tutorial-code</AssemblyName>
66
<OutputType>Exe</OutputType>
@@ -20,7 +20,11 @@
2020
<PackageReference Include="JavascriptEngineSwitcher.Extensions.MsDependencyInjection" Version="3.1.0" />
2121
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.2.3" />
2222
<PackageReference Include="Microsoft.VisualStudio.Web.BrowserLink" Version="2.2.0" />
23-
<PackageReference Include="React.AspNet" Version="5.0.0" />
23+
<PackageReference Include="React.AspNet" Version="5.1.0" />
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" />
2428
</ItemGroup>
2529
<ItemGroup>
2630
<Content Update="Views\Home\Index.cshtml">

tutorial-code/web.config

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,14 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<configuration>
3+
34
<!--
45
Configure your application settings in appsettings.json. Learn more at http://go.microsoft.com/fwlink/?LinkId=786380
56
-->
7+
68
<system.webServer>
79
<handlers>
8-
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
10+
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified"/>
911
</handlers>
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>
12+
<aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false"/>
1613
</system.webServer>
17-
</configuration>
14+
</configuration>

0 commit comments

Comments
 (0)