Azure App Service is an HTTP-based service for hosting web applications, Rest APIs, and mobile back ends, you can develop in your known language using .Net, .Net core, Java, Ruby, Node.JS, PHP, and Python. Asp.net core applications run and scale with both Windows and Linux-based environments. In this article, you will learn more about how to create web apps using asp.net core and publish applications into Azure.
Prerequisites
-
Download and install the latest Visual Studio 2019.
-
Create new Account / Login
Azure.
Create Asp.net Core App
You can start to create an asp.net core app using visual studio. Open Visual Studio and Select to create a new project template as “Asp.net core web application”. you can select your know language, in this demo, we are selecting as “C#” language.
Configure new Project
In the second step, Provide the project name, location, solution name, and click on create
Application Template
Microsoft provides different types of templates for creating apps. We have to create a web application for a demo, so you need to select “Web Application” and click on “Create”.
Once created the application, the solution will be generated with the required file as below
Run the Application in Local
Visual Studio used a default template so you have a working web app right now by entering a project name and selecting a few options. This is a simple auto-generated project, Tap F5 to run the app in debug mode or Ctl-F5 in non-debug mode.
Visual Studio starts IIS Express and runs the app. the address bar shows the local host and port number. The local host always points to the local computer.
The default template is like below with banner image and sample content.
Publish Web App
publish your web app, you must first create and configure a new App Service that you can publish your app to Azure and also follow the below steps .
Step 1
Right Click on Projector Solutions
Step 2
Select “Publish” options on the right-click menu.
Step 3
The below windows will pop up for the first time. You can select “Azure” as a publishing platform.
You can select the Azure App service and operating system which you want to deploy your web app in the below window and click on next.
Select either create an account or Sign in to sign in to your Azure subscription. If you're already signed in, select the account you want.
To the right of App Service instances, click on +.
Select subscription, Resource group and hosting plan in the following screen
-
Subscription – Select the subscription that is listed or select a new one from the drop-down list.
-
Resource group - select New. In New resource group name, enter the resource group name and select OK.
-
Hosting Plan – Select the hosting plan and click on create
Once the wizard completes, successfully completed build and publish web application into Azure, you can refer and try published URL in browser
You can navigate to published url and verify your published website available in Azure and online
You can also navigate to Azure portal and select on All resource and check App service and AppService plan is hosted under your resource. You can verify and manage app service plans in azure portal.
Summary
In this article, you have learned about creating Web Application using Dotnet core and published applications into Azure. if you have any questions/feedback/ issues, please write them in the comment box.