Host ASP.NET Web App On the Azure Cloud Using Visual Studio

Introduction

Website hosting is the most difficult part for some beginner- and intermediate-level developers. Hence, my article is about how to host the asp.net Web app on the Azure Cloud, if the application does not contain any databases. My next article will demonstrate how to host the Web app with the database on the Azure Cloud. The Azure Cloud  is the platform which provides the bundle of services such as hosting, databases and much more.

Pre-Requisites: Azure  Cloud Account must-haves

Step 1

  • Open Visual Studio -> File->New project-> Web-> Select ASP.NET Web app.





  • Select the Empty Web Form Application/MVC. In my case, I selected the Web Forms



  • Add the Web Form in the project by right clicking on the project->Add->WebForm.aspx



  • My Form name is Home.

  • Another thing is “Set the Start Page”. You can do this in the Web.config file to set the default page

  • If some error pops up using this method, then you can set the default Document in the Web.config file.
    1. <system.webServer>  
    2.     <defaultDocument>  
    3.         <files>  
    4.             <clear/>  
    5.             <addvalue="~/Home.aspx" />  
    6.         </files>  
    7.     </defaultDocument>  
    8. </system.webServer>  

Step 2

  • Go to www.portal.azure.com.

  • Give the credentials and log in to Azure.

  • You will see the portal, as shown below:



  • On the left pane, click app services and click add.



  • Enter the valid app name and you can see the domain is .azurewebsites.net.

  • Pick the subscription default --  my subscription is “DreamSpark” -- and create the Resource Group {Resource group, where Azure Cloud  keeps your Web resources}.

  • Hit the create button.

  • After the deployment starts, the app will be successfully deployed. 



  • Click the app.

  • After it, click the download publish settings and we can check all the essential information about the Web app also.



Step 3

  • Go to Visual Studio, right click the project and click publish.



  • Click browse Button and select the publish file, which was downloaded earlier.





  • After clicking, we can see a setting like “Validate Connection” and a lot of other important information.

  • Afterwards, click next.



  • We are able to debug as well as release the app to the Azure Cloud . In my case, I simply release the Web app.



  • Click next. Here, we see what changes I did in the current release. The attributes such as are all the files successfully compiled or not, are all the files are added or not, etc.



  • Click Publish MS Visual Studio successfully. Publish the ASP.NET Web app of Azure Cloud.

    http://howtohost.azurewebsites.net/Home.aspx

Conclusion

Visual Studio provides a fast and an efficient way to host the Web app using the Publish Settings. With the help of this, there is no difficulty to host the Web site. We can also host PHP and other languages.