Deploying ASP.NET Core Applications with Azure App Service

Deploying ASP.NET Core Applications with Azure App Service

Introduction

Cloud computing has become an essential technology for developing scalable, reliable, and high-performing web applications as the landscape of web application development is changing rapidly. As more businesses start using cloud services, cloud development continues to simplify the deployment of their web applications and enhance the performance of their applications. 

Because Azure App Service integrates seamlessly with ASP.NET Core, it enables developers to deploy their web applications quickly while also ensuring they are highly available and scalable.

Creating and Deploying a .NET Core Application on Azure App Service

Build a Sample ASP.NET Core Application

You’ll need a basic ASP.NET Core web application to go through the Azure App Service deployment workflow. 

Ensure you have access to the following before you get started:

  • .NET SDK (version 6 or later recommended)
  • Azure CLI
  • Visual Studio / VS Code (optional but helpful)

 

The .NET CLI enables developers to rapidly create and work on .NET projects from the command line.

The following commands will create a new solution and project for the web application.

dotnet new sln -n AzureDotNetExample

dotnet new webapp -n AzureDotNetExample -o AzureDotNetExample

dotnet sln add AzureDotNetExample

What Each Command Does

  • dotnet new sln: Creates a new solution file
  • dotnet new webapp: Generates an ASP.NET Core Razor Pages application
  • dotnet sln add: Adds the project to the solution file

 

Run Your Application Locally

Verify your application works properly before deploying it to the cloud.

Run the following command:

dotnet run –project ./AzureDotNetExample

Once the application starts, open the browser and navigate to:

http://localhost:5000

You should see the default ASP.NET Core web application page.

Deploying the Application to Azure App Service

Once you’ve verified that your app works on your machine properly, the next step is to deploy it to Microsoft Azure App Service, which provides a fully-manageable platform for hosting and running web applications.

There are several ways that the App Service automatically handles.

  • Infrastructure
  • Server configuration
  • Scaling applications
  •  Keeping the app secure with patches, etc.

 

This allows developers to be able to focus more on building their apps and not have to worry about maintaining servers.

Step 1: Log in to Azure

First, authenticate your Azure account using the Azure CLI.

az login

This command will open a browser window where you can log in to your Azure account.

Step 2: Deploy the Application Using Azure CLI

Navigate to your project directory and run the following command:

az webapp up \

–name niotechone-dotnet-app \

–resource-group niotechone-dotnet-rg \

–plan niotechone-appservice-plan \

–sku F1 \

–runtime “DOTNET:6”

Explanation of Parameters

Parameter

Perpose

–name

Indicates the name of your Azure Web App

–resource-group

Container for Azure resources as a logical grouping

–plan

Defines the App Service hosting plan

–sku F1

Uses the Free tier for hosting

–sku F1

.NET Runtime (e.g. Version)

Azure will automatically do the following:

1.  Create a Resource Group

2. Create an App Service Plan

3. Build your project

4. Deploy your application

Example Deployment Output

  • After the command finishes, you will see the same log
  • Creating Resource Group ‘niotechone-dotnet-rg’
  • Creating App Service Plan ‘niotechone-appservice-plan’
  • Creating Web App ‘niotechone-dotnet-app’
  • Deploying application package…
  • Deployment successful

Monitoring .NET Applications on Azure

After your app is live, you need to keep an eye on its performance so that it continues to function well.

Some benefits of monitoring an app are:

  • Detecting performance bottlenecks
  • Identifying slow database queries
  • Tracking response time for APIs
  • Analyzing the usage of your server

Installing Application Monitoring with Example Concept

For advanced monitoring, you can configure environment variables for monitoring tools.

Example:

az webapp config appsettings set \

–resource-group niotechone-dotnet-rg \

–name niotechone-dotnet-app \

–settings APP_ENV=production APP_VERSION=1.0

Viewing Application Performance

Developers can monitor key performance indicators via dashboards that include:

  • Request Duration
  • CPU Utilization
  • Memory Utilization
  • Unsuccessful HTTP Requests
  • Latency in APIs

 

These observations give the development team the ability to quickly discover and address performance problems.

Best Practices for Azure App Service Deployment

To optimize the performance of your ASP.NET Core Application, follow these best Practices:

1. Utilize Application Insights

Track errors & performance in real-time.

2. Enable Automatic Scaling

Automatically scale out when experiencing a high volume of traffic.

3. Use Deployment Slots

Allow you to test updates in the staging slot before deploying to the production slot.

4. Monitor Logs

Use Azure Logs to diagnose your application’s problems quickly.

Why Businesses Choose Azure for .NET Applications

Many businesses use Azure for their .NET applications due to:

  • High scalability
  • Strong security
  • Global infrastructure
  • Easy integration with Microsoft technologies

 

Companies such as Niotechone Software Solution Pvt. Ltd. assist businesses in creating and deploying cloud-based .NET applications through the use of Azure App Service to improve performance and reliability.

Conclusion

ASP.NET Core app deployment in Azure App Service makes hosting apps in the cloud much easier since it’s a fully managed service that allows developers to create, publish, and operate web apps in the cloud.

.NET developers using Azure cloud services will be able to provide their end-users with secure and performant applications, while also reducing their infrastructure management tasks through the use of Azure’s managed infrastructure.

Frequently Asked Questions FAQs

Microsoft's Azure App Service is a cloud platform designed specifically for building, deploying, and hosting web applications (such as APIs and mobile backends) in the cloud.

There are various deployment options available to get an ASP.NET Core (or other framework) application running in an Azure App Service web (or mobile) application

Azure App Service provides several benefits for .NET developers, including:

  • Automatic scaling
  • Built-in security
  • Easy deployment

 

Integration with Azure DevOps and GitHub

Yes! Azure App Service does have the ability to automatically scale your application and resources based on application traffic patterns

Utilizing .NET applications running on Azure will assist in improving the application performance, reliability, and security of your company's software applications. Companies like Niotechone Software Solution Pvt. Ltd.