To deploy an ASP.NET Core app to IIS isn’t that difficult, but hosting in ASP.NET Core is a little different than ASP.NET.
Lets Configure an ASP.NET Core App For IIS
To mention about ASP.NET Core project is that they are console applications. Your project has a Program.cs file like a console app would have and it has the following code:
public class Program
public static void Main(string args)
var host = new WebHostBuilder()
What do you mean by WebHostBuilder?
All ASP.NET Core applications need a WebHost object that serves as an application and web server. WebHostBuilder is used to configure and develop WebHost. You can see UseKestrel() and UseIISIntegration() in the WebHostBuilder setup code.
What do they do?
UseKestrel() – This registers IServer interface for Kestrel that will be used to host your application. In the future, there would be other options, which include WebListener and that would be Windows only.
UseIISIntegration() – This says to ASP.NET that IIS will work as a reverse proxy in front of Kestrel. This then specifies some settings around which port Kestrel must listen on, forward headers, and other details.
If you are planning to deploy your application to IIS, UseIISIntegration() is needed.
What is AspNetCoreModule?
An ASP.NET Core projects create a web.config file. This is used to deploy your application to IIS. It registers AspNetCoreModule as an HTTP handler.
Default web.config for ASP.NET Core:
<?xml version=”1.0″ encoding=”utf-8″?>
<add name=”aspNetCore” path=”*” verb=”*” modules=”AspNetCoreModule” resourceType=”Unspecified”/>
<aspNetCore processPath=”%LAUNCHER_PATH%” arguments=”%LAUNCHER_ARGS%” stdoutLogEnabled=”false” stdoutLogFile=”.\logs\stdout” forwardWindowsAuthToken=”false”/>
AspNetCoreModule manages all incoming traffic to IIS and acts as reverse proxy that knows how to forward the traffic to your ASP.NET Core application.
Install .NET Core Windows Server Hosting Bundle
Before you start deploying your application, you must install the .NET Core hosting bundle for IIS. This will install .NET Core runtime, libraries, and ASP.NET Core module for IIS.
After doing that, you might need to do a “net stop was /y” and “net start w3svc” to make sure all the changes are taken for IIS.
Steps to Deploy ASP.NET Core to IIS
You have to configure WebHostBuilder to use Kestrel and IIS. Your web.config must exist and look similar to the example above.
Step 1: Publish to File Folder
Publish to a Folder with VS 2017
Step 2: Copy Files to Preferred IIS Location
Copy the published files where you want them live. If you deploy to a remote server, you might need to zip the files and move to the server. If you intend to deploy to a local dev box, you can copy them locally.
Step 3: Create Application in IIS
Firstly, make a new IIS Application Pool. You might like to develop one under the .NET CLR version of “No Managed Code“. Remember IIS works as a reverse proxy, it doesn’t execute any .NET code.
Next, develop your new application under your existing IIS Site, or design a new IIS site.
Step 4: Load Your App
Your application must load well. If it doesn’t, check the output logging from it. Within your web.config file, you explain how IIS starts up your ASP.NET Core process. Get output logging done by setting stdoutLogEnabled=true and you might also want to change the log output location as configured in stdout log file.
Microsoft suggests using IIS with any public facing site for ASP.NET core hosting. IIS gives additional levels of configuration, security, management, logging, and several other things.
One of the biggest advantages of using IIS is process management. IIS will start your app automatically and restart it if a crash has to occur.
Now with this, we conclude. We hope this was of help to you.
If you want to enhance yourself in Dot Net Course and improve yourself through Dot NET training program then our institute CRB Tech Solutions would be of great help and support. We offer a well-structured program for the best Dot Net Course. Among many reputed institutes of dot net training and placement in Pune.
Stay connected to with us for your technical up-gradation and to remain updated with all the happenings in the world of Dot Net.