Deploy ASP.NET 6 Web applications to IIS

ASP.NET 6 applications, including REST webservices, have a different deployment architecture that is designed to be run anywhere. They also have different modes of deployment to ensure this portability. Since some hosting configuration is always necessary its advised to publish the application with the following properties:

  • Delete existing files: true
  • Configuration: release
  • Target framework: net6.0
  • Deployment mode: Framework-dependent
  • Target runtime: portable

You can create a folder installation to package your application for delivery in an external IIS.

To support your deployment, IIS requires the installation of the corresponding ASP.NET Core runtime. In particular, it requires the hosting module that enables the interaction between IIS and ASP.NET Core web apps. Please install the latest Quidgest setups with the Server workload, or download and install manually the Microsoft supplied ASP.NET Core 6.0 Runtime - Windows Hosting Bundle Installer

In IIS you should create an application pool that will contain only this new Web application exclusively. Sharing pools is not recommended for ASP.NET Core 6 web applications. The application pool needs to be configured with:

  • .Net Clr version: No managed code
  • Managed pipeline mode: Integrated
  • Enable 32 bit applications: False

Then you can create either a Website or a Virtual application within a website. The website creation requires no additional configuration. A virtual application deployment for REST webservices requires one additional configuration for Swagger documentation to be available. Edit the file appsettings.json and supply the name of the virtual directory you created to the virtualDirectory property. Example:

{
    "VirtualDirectory": "vd_relative_path"
}