liveBook · Manning

IIS integration

As explained in ASP.NET Core in Action, 3e

UseIISIntegration is an ASP.NET Core extension method that configures an application for out-of-process hosting behind Internet Information Services.

IIS integration prepares an ASP.NET Core application to work with Internet Information Services. With out-of-process hosting, IIS acts as a reverse proxy: it forwards incoming requests to the application and returns the application’s responses. section 27.2.2

Choose the hosting integration that matches the IIS hosting model:

  • UseIIS() configures in-process hosting, where IIS hosts the application directly inside the IIS process. section 27.2.2
  • UseIISIntegration() configures out-of-process hosting, where the application runs separately behind IIS. section 27.2.2
  • WebApplicationBuilder adds IIS integration automatically; custom application builders using HostBuilder must add the appropriate extension method explicitly. section 27.2.2
  • The methods have no effect when the application is not hosted with IIS, so including them is safe in that situation. section 27.2.2

Custom builder with out-of-process IIS hosting

An application built with a custom HostBuilder can call UseIISIntegration() so the application and IIS negotiate the configuration required for out-of-process hosting. Applications created with WebApplicationBuilder normally need no additional call. section 27.2.2

A reverse proxy can change request details while forwarding traffic. ForwardedHeadersMiddleware uses headers such as X-Forwarded-For and X-Forwarded-Proto to restore the client address and original HTTP scheme; WebApplicationBuilder adds this middleware in a disabled state, enabled with ASPNETCORE_FORWARDEDHEADERS_ENABLED=true. section 27.3.2

Figure 27.8 The published application, using IIS as a reverse proxy listening at the URL http://localhost:81
CH27_F08_Lock3

The deployment arrangement shows IIS acting as a reverse proxy in front of the published application. section 27.2.2

How ASP.NET Core in Action, 3e covers it

How deep it goes
Explains hosting-model differences and forwarded-request behavior, but defers detailed IIS deployment configuration.
Examples
Uses UseIISIntegration(), UseIIS(), forwarded-header configuration, and an IIS reverse-proxy deployment arrangement.
What it assumes
Assumes basic ASP.NET Core application hosting and distinguishes WebApplicationBuilder from custom HostBuilder construction.
What you can do after
Operate/configure an ASP.NET Core application for IIS hosting and preserve forwarded request information.
How it connects
Connects IIS integration with reverse proxies, HostBuilder, WebApplicationBuilder, forwarded headers, and middleware.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of ASP.NET Core in Action, 3e. The section links point to the parts of the book it draws on.