Sunday, June 25, 2017

Host ASP.NET MVC / WEB FORM to AZURE

PS:- To do this you need to create an Azure account. Choose any subscription method which suitable for you. Here I have used the Microsoft Imagine subscription plan.

01). Create a resource group in Azure.

  • Click + and type Resource Group in search box then click Create


  •  Write a name for resource group and choose Subscription method and Resource group location as wish.


02). Create a web app in Azure

  • Click + and type Web app in search box, then click Create


  • Write a name for app name and choose Subscription method and Resource group. Here I have used the above-created resource group without creating a new one.


03). Create a Database in Azure
  • Click and type SQL Database in search box, then click Create
  • Write a name for app name and choose Subscription method and Resource group. Here I have used the above-created resource group without creating a new one.

  •  Click on Server and create a new server. remember the password you enter.


  •  Select the pricing tier as you wish. For me only the free tier is available.


04). Create database Script in microsoft SQL.
  • Open SQL and select the DB that should create the script. Right click on the DB name and do as follows(Task => Genarate Script)




  • Click Advance then select the Type of data to script as Schema and data, then tick on Save to new query window and click on Next




  • Here is the script that creates


05). Add Script DB to the database we created in Azure.




  • Use the Authorization type as SQL server authentication. Enter the username and password enter when creating the SQL Server in Azure

 PS: Delete the USE keyword in the script and click RUN



06). Change the connection string in ASP.NET app
  • select the DB created in azure click connection string, copy the data


  • Sample connection string as follows,
Server=tcp:azuretestblogger.database.windows.net,1433;Initial Catalog=AzureTestDB;Persist Security Info=False;User ID=*****;Password=*****; MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;
  • Change the ID and Password. There you have to enter SQL server username and password.


07). Get publish profile
  • Select the web app created in Azure and click publish profile. So that ".PublishhSettings" file will be download.

  • You navigate to the URL of the web app, there you can see as follows.


08). Deploying code to the app 
  • Go to .net project and right click there. select Publish.. 
  • Click Import and browse for the downloaded .PublihSettings file



  •  Enter the connection string

  • Click Publish
  • There you can the dialog as follow

09). Navigate to the URL of web app

No comments:

Post a Comment