Introduction
Deployment is a mandatory next step after the development of your product. Depending on your application type and technology used; you will package your product accordingly for commercial use. For ASP.NET MVC platforms, you need a Windows server with an IIS manager installed to deploy your web application. You can also package your web application in the Docker environment and then deploy your docker package on any server machine that satisfies the hardware requirement for your web application. Note that Docker is independent of the local OS environment.
Today, I shall be demonstrating the deployment of any ASP.NET MVC5 application on a Windows machine with an IIS server installed.
Prerequisites
Following are some prerequisites before you proceed any further in this tutorial.
- Enable/Install Microsoft Web Deploy & IIS Server.
You can also watch this video tutorial to deploy the ASP.NET MVC5 web application on a Windows machine with an IIS server installed.
Watch Now!
Let's begin now.
Step 1. Right-click on your ASP.NET MVC5 application inside Visual Studio and then click "Publish".
Step 2. Now, select the "IIS" option from the left menu and click the "Create Profile" button.
Step 3. Change your publish method to "Web Deploy Package" and provide your package location, then click "Next".
Step 4. Click "Save" on the next screen.
Step 5. Now, click "Publish" on the publish screen.
You can see your web application deployment package stored as a ".zip" file on your target location.
Step 6. Now, search for "Internet Information Services (IIS) Manager" on your machine and then click it.
Step 7. Right-click on "Application Pool" and then click "Add Application Pool".
Step 8. Type your application pool name and configure the settings, as shown below, and then click "OK".
You will see that your application pool has been created and started.
Step 9. Now, right-click on "Sites" and then click "Add Website".
Step 10. On the "Add Website" window, first select the application pool that you have created specifically for your ASP.NET MVC5 web application, click the "Select" button, then choose your application pool, and then click "OK" as shown below i.e.
Step 11. Now, provide configuration settings on the "Add Website" screen and then click "OK" as shown below.
You can see that your empty website is being created on the server as shown below.
Step 12. Right-click on the "Test" site then click "Deploy->Import Application" as shown below.
Step 13. On the "Select Package" screen, provide the location path of your published ".zip" web application file and then click "Next" as shown below i.e.
Step 14. On the next screen, select all the options and then click "Next" as shown below.
Step 15. Click "Next" on the next screen as shown below.
Step 16. Click the "Finish" button, your web application has been deployed successfully as shown below.
Step 17. You need to purchase & configure your custom domain name on the server, to access your web application from a web browser using a custom URL address. To configure a custom domain name free of cost on your local Windows machine for custom URL address access, follow the steps provided at the end of the video tutorial, link to the video tutorial is provided above in this article. Therefore, after your custom URL address configuration, type your URL address in the browser and you will be able to access your ASP.NET MVC5 web application, which has been successfully deployed on the windows IIS server i.e.
Conclusion
In this article, you learned to deploy your ASP.NET MVC5 web application on a Windows machine with an IIS server installed. You learned to publish your ASP.NET MVC5 application as a web-deployed ZIP package. You also learned to add a new application pool on your IIS server and finally, you learned to add a new website on your IIS server with a custom domain name URL address.