How to Publish ASP.Net MVC 5.0 Application on Windows Azure: Part 4

Introduction

Hi Guys. I am back with my next article where we'll learn how to host an ASP.Net MVC 5.0 application in the Windows Azure Cloud. So let's see first how to create a website on Visual Studio 2015 with ASP.Net MVC 5.0. Read my previous articles to learn more about the ASP.Net MVC Framework. Links.

We have an ASP.Net MVC 5.0 application in Visual Studio 2015 so open the website solution and see, if we already have a controller and view that are already running but not on IIS running on IISExpress.

Solution explorer

And this is the view output in the browser.

Output in the browser

The URL is http://localhost:6339/Home/Index. It can be anything because it's running by IISExpress. That is, it allows running every website on a unique port number if you want to show that so you may be open the IISExpress Taskbar.

IISExpress Taskbar

Now it's time to go to Azure online and we require an Azure account so go to this link and create an account free for the first month.

http://azure.microsoft.com/en-us/account/

Then you will find the page from where you can go to manage your Azure Account. Go to Manage Portal.

Go to Manage Portal

Now the new open page will show you your existing WebApps, SQL Databases, Cloud Services, and more. So if you want to host your WebApps then create a WebApps to publish your ASP.Net MVC Web site directly.

 SQL Databases

Now click on the New Button on the left side of the page bottom to create an app.

New Button

Select COMPUTE -> WEB APP-> Quick Create.

Quick Create

Now enter the required web URL and select App Service Plan. Now click on Create Web App.

Create Web App

Now you will see your new Web App in your existing web app list.

Create web app list

Click on the URL to test whether the URL is running properly.

URL is running properly

Now go to the Dashboard then select your newly created web app.

Dashboard

This is the Dashboard on the new web app where you can track all the requests to the URL of the last hour, last day, and more.

Csharpcorner

Now download the Publish Setting to publish your ASP.Net Web Site to the Windows Azure Account. So go to the link in Quick Glance.

Quick Glance

After clicking on that link it will save a “.PublishSettings” file to your Machine.

Link

Now go to the Solution Explorer of your project and right-click on the Project File and select the Publish option.

Publish option

Now select import because we have the “.PublishSettings” file directly so click on import.

PublishSettings

Now login with your Microsoft Windows Azure Account.

Microsoft Windows Azure Account

Now import your “.PublishSettings” files from your downloaded location.

Downloaded location

Then click on OK.

Ok button

This new tab will show you all the settings of your server before going to the next tab to first validate your connection settings. If all is correct then it'll show you a Green icon so now you can go to the next tab.

Green icon

On this tab, we can see all the local databases that we need to upload but we have no local database to upload.

Local database

On the next tab click on the Start Preview button to select all the required files to be published.

 Start preview button

Publish web

Now finally just click on Publish and see it is ready to call from anywhere because in the output window, you can see that the publish was successful.

Publish was successful

Now open your browser and request your hosted URL on Windows Azure.

Windows Azure

I hope you enjoyed this article about how to publish an ASP.Net MVC 5.0 application to Microsoft Windows Azure Account.

Thanks.

Connect (“Nitin Pandit”)