AspNetCore.Docs icon indicating copy to clipboard operation
AspNetCore.Docs copied to clipboard

Guidance on using ASP.NET Core 2.1 on .NET Framework

Open shirhatti opened this issue 3 years ago • 10 comments

I'm happy to PR/contribute this content, but I need guidance on where it'll live. Should it live in the latest docset? Or should it only exist for 2.1?

Issue description

I'd like to add guidance on using ASP.NET Core 2.1 on .NET Framework when hosting in IIS. Especially given that 2.1 is going out of support soon. We will no longer be producing 2.1 SDKs or 2.1 hosting bundles.

Dev Requirements:

  • A supported version of the .NET SDK to build ASP.NET Core 2.1 applications for .NET Framework

Production Requirements:

  • A supported version of the .NET Hosting bundle.

NOTE: The .NET Hosting bundle contains other .NET Runtime components. If you do not intend to use the runtime components, the guidance is to install ANCM without the runtime components.

./dotnet-hosting-x.y.z-win.exe /install /q /norestart OPT_NO_RUNTIME=1 OPT_NO_SHAREDFX=1

Build-time changes:

Add the following properties to you project file:

  <PropertyGroup>
    <AspNetCoreModuleName>AspNetCoreModuleV2</AspNetCoreModuleName>
    <AspNetCoreHostingModel>OutOfProcess</AspNetCoreHostingModel>
  </PropertyGroup>

Alternatively, if you do not want to make a build change, you could just change the published web.config to start using ANCMv2 and specify outofprocess as the hosting model.

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <system.webServer>
    <handlers>
      <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
    </handlers>
    <aspNetCore processPath="WebApplication37.exe" arguments="" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="outofprocess" />
  </system.webServer>
</configuration>

shirhatti avatar Jun 18 '21 01:06 shirhatti