Nowadays, most people are choosing web hosting on a cloud platform. Microsoft lovers like us basically select “Microsoft Azure” as our hosting environment.That’s the reason I have written this new article defining a simple way of hosting in Azure.
Before reading this article, you must read the articles given below for ASP.NET Core knowledge.
- GETTING STARTED WITH ASP.NET CORE 1.0
- PROJECT LAYOUT IN ASP.NET CORE 1.0
- MIDDLEWARE AND STATICFILES IN ASP.NET CORE 1.0 – PART 1
- MIDDLEWARE AND STATICFILES IN ASP.NET CORE 1.0 – PART 2
First, we need to create an account on the Azure portal. Only then can we host the application in the cloud environment. So, please check the following steps to create an Azure account.
Azure Account Registration
Create an account through this link to Azure Portal.
We need to host our application in a particular domain. Check the following steps –
- Click on “All resources” on the left side menu and it will open a dashboard with an empty or already existing list of resources that we have created earlier.
- Click on the “Add” button and it will open another window with multiple options. We can choose an appropriate option to host our application.
- As per our requirement, we choose “Web + Mobile” and clicked on the “Web App” on the right side.
4. It will open another form to fill up our app details to host. We need to give a unique name in the “Appname” section and It will create a subdomain for our ASP.NET Core application.
5. We choose subscription as “Free Trial” because we created a free account on the Azure portal.
6. We need to host our app resources in Resource group, So first we need to create a resource group name in our Azure account. But we choose existing resource group name “AzureDemo” that we are already created in our Azure account.
7.”OS ( Operating System )” we selected as “Windows”( As per our requirement ).
8. We can create our own App Service Plan name.
9. Application Insight will give you the more clarity about your hosted app. Eg. analytics, etc.
10. Click on the “Create” button and wait for the build success.
11. Another way to create the Resource Group Name – click on “Resource groups -> Add”.
12. Once the build is succeeded, then we can see this output.
Simple steps to create an Asp.Net Core Application
- Open our VisualStudio then click on File > New > Project.
- Select Visual C# > Web > ASP.NET Core Web Application.
- We have given our application name as “MyFirstAzureWebApp”.
- Then, click OK.
- Click on the “Ctrl+F5”
App Publishing into Azure
We created a default ASP.NET Core application ( We have done some changes in UI Section) for the publishing process.
- Right click on the application and click on the Publish menu.
2. Click on the “Microsoft Azure App Service”
3. We choose our existing resource group name ( That we created ! “AzureDemo” ) in our Azure Portal and It will display the App Name inside the “AzureDemo” folder. This will display only when we are login through the Visual Studio using Azure credentials ( Email & Password).
The application is hosted in given domain address http://menoth.azurewebsites.net/
You can download other ASP.NET Core source codes from MSDN Code, using the link, mentioned below.
We learned how to create and deploy an ASP.NET Core web app in Azure. I hope this article is useful for all ASP.NET Core & Azure beginners.