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.
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.
Now, let's demonstrate the preceding concept step by step; i.e., how to publish ASP.NET Web MVC applications practically.
Right click on the created ASP.NET MVC application, as shown below.
Now, click the previously shown Publish option. It will open the Windows, mentioned below.
Now, select the option, where you want to save the published code. There are lots of options given by Visual Studio to save the published code , as shown below.
In the preceding image, we have seen that there are many options listed to publish the application, let's learn about them in brief.
This option is used to publish the Application into your own machine location or FTP Server, as per your most convenient way.
This option is used to publish REST API's Services in Cloud.
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.
Now, in this article, we are going to publish an application in our local machine file system, so we need to choose custom target option. First, we need to create the profile to publish the application, so it can be a consistent setting to publish the same application in the future. Choose custom option from preceding explained target option, as shown below.
Now, give the profile name as per your requirement and click ok. It will create the custom profile, as per your given name.
Now, configure the created profile, which decides where and how to publish the code. Select the publish method from the number of options, which are shown below.
Now, choose the file system method from preceding methods and click Next button.
Now, choose the target location of your local system in which you want to store the published code, as shown below.
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.
Now, choose what type of code you want in production environment by choosing release or debug option, as shown below.
Now, let's learn in brief about debug and release option.
After the configuration, publish configuration tool will look like, as shown below.
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.
What is Publishing?
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
Step 1: Create an 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.
Watch video which explains how to create ASP.NET MVC application step by step
Watch video which explains how to create ASP.NET MVC application step by step
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
- Import
- Custom
- Microsoft Azure API apps
- Microsoft Azure virtual machine
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.
Note
- 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
Next Article
Summary
I hope, this article is useful for all the readers. If you have any suggestions, please contact me.
Don't Forget To
- Subscribe my YouTube Chanel Compile Mode
- Subscribe free email alert of compilemode.com
- Like Facebook page .
- Follow on Twitter.
- Share to your friends
Post a Comment