When you want any application available publicly, you need to host it on the server and before hosting, it requires certain processes in terms of making an Application code suitable to the host. Thus, in this article, we will learn how to publish ASP.NET Web API Applications, using File system method. Therefore, 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 steps, mentioned below before hosting to the Server.
Develop an Application -- Publish an Application - Host an Application on IIS.
Now, just demonstrate the preceding concept step by step; i.e, how to publish ASP.NET Web API Applications practically.
Create ASP.NET Web API 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 Web API Application, please refer to my previous article, mentioned below.
I hope, you have created ASP.NET Application by reading the preceding article .
Publish an Application
Now, click the previously shown Publish option. It will open the Windows, mentioned below.
Select Publish Target
- Microsoft Azure App Service
This is one of the services provided by Microsoft Azure to publish the different types of the Application such as Web, mobile, REST and other into Azure (Cloud). You need a Microsoft Azure subscription to use this option.
This option is used to publish the Application, which is based on the predefined configuration files given by your hosting provider , which will directly publish the files in your hosting provider environment.
This option is used to publish the Application into your own machine location or FTP Server, as per your most convenient way.
- Microsoft Azure API apps This option is used to publish REST API's Services in Cloud.
- Microsoft Azure virtual machineThis 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.
Create Custom profile
Now, give the profile name as per your requirement and click OK. It will create the custom profile, as per your given name.
Choose Publish Method
Now, choose the file system method from preceding methods and click Next button.
Choose File System location
In the preceding screenshot, we have selected the target location E drive to store the published files. It may be different in your case, as per you machine and click Next button .
Choose Publish code type
Now, let's learn in brief about debug and release option.
- DebugChoose this option when you want to debug your Application after the hosting.
- ReleaseChoose this option when you do not want to debug the Application after hosting and make the Application faster .
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 files, as shown below.
We have seen our published code, which is used to host in IIS. I hope from all the preceding examples, we learned how to publish ASP.NET Web API Service in File system .
- Choose the publish target location, as per your system.
- Select proper publish method, as per your requirement.
I hope, this article is useful for all the readers. If you have any suggestions, please contact me.