Move the published code on Hosting ServerCopy the "Published files" which we have seen in our previous article Publishing an ASP.NET MVC Application Using File System and paste those on respective servers where you want to host the ASP.NET MVC application. In our last article we have published code in the E drive of my server, as shown in the following image .
The above image is of IIS 10 Manager of my Windows 10 machine. The view as well as options might be different on your machine depending on the OS version.
Add Website to host an ASP.NET MVC applicationRight click on "Site" in IIS and click on add new website, as shown in the following screenshot.
I hope you understood the preceding configuration by highlighted text.
Define Site Name & Application PoolDefine the site name which will be useful to uniquely identify the site within the IIS server. After specifying the site name, choose the application pool from available pools. You can even create a custom application pool with any desired name. Currently, our IIS manager has the following application Pools.
Browse and select Published Folder path
Define IP address & PortChoose one IP address from the list of available IP addresses and define the unique port number for the application, which will be unique within the defined IP address.
Choose Protocol & Host name (optional )
Preceding is our IIS hosted ASP.NET MVC application which is running in browser.
- This article is just guideline to show how to host ASP.NET MVC web API application on IIS .
- Optimize the speed by setting debug as false etc., from web.config file as per your skills.
- In this article, the optimization is not covered in depth.
- Configure the authentication in IIS as per your requirement .
SummaryI hope, this article is useful for all the readers to learn about hosting an ASP.NET MVC web application on local IIS. If you have any suggestions, please contact me.
Learn How to Create an ASP.NET MVC Application Step by Step