'Leading-edge' - sure. 'Bleeding-edge' - not so interested.
I decided it's time to re-write one of my personal web apps. At the time ASP.NET Core had been out for a few years and I figured it's time to give it a try. I'm committed to staying up with current technology, but have learned it's best to give it a few years. This effort was a reminder why it's OK to give a new technology a few years before jumping on it. It turns at that currently IIS (v. 10.0) is not configured to handle this new framework yet. As a result, there's some extra configuration required currently.
Installations
Download and install the .NET Core Windows Server Hosting bundle on the server. The bundle will install the .NET Core Runtime, .NET Core Library, and the ASP.NET Core Module. https://dotnet.microsoft.com/download/dotnet-core.
From there, select the version that matches your .NET Core settings for your project. There's a difference in what IIS modules are installed between 2.2 and 3.0. Version 2.2 installs "AspNetCoreModule" while 3.0 installs "AspNetCoreModuleV2".To see what version is installed, bring up IIS, select your web app and click "Modules":
Edit your project file
Manually edit the project file. Under PropertyGroup,
<PropertyGroup> <TargetFramework>netcoreapp2.1</TargetFramework> <UserSecretsId>aspnet-NetCoreWeb1-B79AD716-2947-4188-95C9-7A3C6EB73172</UserSecretsId> <AspNetCoreModuleName>AspNetCoreModule</AspNetCoreModuleName> <AspNetCoreHostingModel>OutOfProcess</AspNetCoreHostingModel> </PropertyGroup>
Notice that the
Add a web.config file
By default, a web.config file was NOT added to your project. You will need to add one. Here are the contents:
<?xml version="1.0" encoding="utf-8"?> <configuration> <system.webServer> <handlers> <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" /> </handlers> <aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false"> <environmentVariables /> </aspNetCore> </system.webServer> </configuration>
Update your program.cs
In your program.cs, modify the CreateWebHostBuilder function to look like this:
public static IWebHostBuilder CreateWebHostBuilder(string[] args) => WebHost.CreateDefaultBuilder(args) .UseKestrel() .UseContentRoot(Directory.GetCurrentDirectory()) .UseIISIntegration() .UseStartup<Startup>();
Setup your IIS application
In IIS, create a new App Pool that has its .NET CLR version set to "No Managed Code". Then use that app pool for your application.
That's pretty much all that is needed. Happy Coding!