In my previous few articles we have learned how to create ASP.NET MVC web application, Now in this article, we will learn how to publish ASP.NET MVC Applications, using File system method, Let's start step by step, so beginners can also understand .
What is Publishing ?
Publishing is the process to make an application code suitable to host on the Server by merging multiple class codes into DLLs and by keeping only the required UI code .
The web application goes through the following standard procedure before hosting to the Server.
- Developing an application
- Publishing an application
- Hosting an application on IIS
Now, let's demonstrate the preceding concept step by step; i.e, how to publish ASP.NET Web MVC applications practically.
Step 1: Create ASP.NET MVC application
If you want to publish any application, first we need to create the Application. If you don't know how to create ASP.NET MVC application, Please refer to my previous articles and Video tutorials by using following links,
Step 2: Publish an Application
Now, click the previously shown Publish option. It will open the Windows, mentioned below.
Step 3: Select Publish Target
In the preceding image, we have seen that there are many options listed to publish the application, let's learn about them in brief.
- Microsoft Azure App Service
- Microsoft Azure API apps
This option is used to publish REST API's Services in Cloud.
- Microsoft Azure virtual machine
This option is used to publish the Application in Microsoft Azure virtual machine (Cloud), which requires an Azure subscription .
There are many other options to publish the Application, using which we can publish .NET application.
Step 4: Create Publish profile
Now, give the profile name as per your requirement and click ok. It will create the custom profile, as per your given name.
Step 5: Choose Publish Method
Now, choose the file system method from preceding methods and click Next button.
Step 6: Choose File System Location
In the preceding screenshot, we have selected the target location E drive to store the published code. It may be different in your case, as per you machine, No click Next button .
Step 7: Choose Publish code type
Now, let's learn in brief about debug and release option.
- Debug: Choose this option when you want to debug your application after the hosting.
- Release: Choose this option when you do not want to debug the Application after hosting and make the application faster .
Step 8: Preview the configuration
Now, click Publish option and watch the output Window, as shown below.
Now, as shown in the preceding screenshot's highlighted section, our application code is published in our specified file system location. Now, navigate to the target folder and see the published code and files as shown below.
Preceding is our published code, which is used to host in IIS. I hope from all the preceding examples, we learned how to publish ASP.NET MVC application in File system .
- Choose the publish target location, as per your system.
- Select proper publish method, as per your requirement.
- These Publish steps are different in Visual Studio 2017
I hope, this article is useful for all the readers. If you have any suggestions, please contact me.