How to do it...

  1. Let's create a new ASP.NET Core project and serve it in IIS:
dotnet new web 
  1. Open the Program.cs file and look for the following code block:
public static IWebHost BuildWebHost(string[] args) => 
WebHost.CreateDefaultBuilder(args) 
.UseStartup<Startup>() 
.Build(); 
  1. We should add a UseIISIntegration() method call in that function as follows:
public static IWebHost BuildWebHost(string[] args) => 
WebHost.CreateDefaultBuilder(args) 
.UseStartup<Startup>() 
.UseIISIntegration() 
.Build(); 
The UseIISIntegration() method call is important and required if we're going to deploy our project to IIS.

UseIISIntegration() method makes the ASP.NET Core application to use IIS as a reverse-proxy and specify which port will be listened, and ...

Get ASP.NET Core MVC 2.0 Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.