How to deploy an ASP.NET Web App

How to deploy an ASP.NET Web App

1. Introduction: What is ASP.NET and Why Should You Care?

Imagine building a house. ASP.NET is like the framework that holds your house together, ensuring everything is in place—from the foundation to the walls to the roof. In web development, ASP.NET serves as this reliable framework, helping developers create web applications that are fast, secure, and scalable. If you're a beginner, think of it as the toolbox you need to build a strong, functional web app.


2. Step-by-Step Guide to Deploying an ASP.NET Web App

Let's walk through the steps of deploying an ASP.NET web app, just like assembling a Lego model. Each block (or step) is essential to completing the model.


1. Create an ASP.NET web app

  1. Open Visual Studio and then select Create a new project.
  2. In Create a new project, find, and select ASP.NET Core Web App (Razor Pages), then select Next.
  3. In Configure your new project, name the application Webapp and then select Next.
  4. Select .NET 8.0 (Long Term Support).
  5. Ensure Authentication type is set to None. Select Create.
  6. From the Visual Studio menu, select Debug > Start Without Debugging to run the web app locally. If you see a message asking you to trust a self-signed certificate, select Yes.


2. Publish your web app

Follow these steps to create your App Service resources and publish your project:

  1. In Solution Explorer, right-click the Webapp project and select Publish.
  2. In Publish, select Azure and then Next.
  3. Choose the Azure App Service (Windows). Then, select Next.
  4. Select Add an Account or Sign in to sign in to your Azure subscription.
  5. To the right of App Service instances, select +.
  6. For Subscription, accept the subscription that is listed or select a new one from the drop-down list.
  7. For Resource group, select New. In New resource group name, enter TestWebApp and select OK.
  8. For Hosting Plan, select New.
  9. In the Hosting Plan: Create new dialog, enter the values specified in the following table:
  10. In Name, enter a unique app name.
  11. Select Create to create the Azure resources.
  12. Once the wizard completes, the Azure resources are created for you, and you're ready to publish your ASP.NET Core project.
  13. In the Publish dialog, ensure your new App Service app is selected, then select Finish, then select Close. Visual Studio creates a publish profile for you for the selected App Service app.
  14. In the Publish page, select Publish. If you see a warning message, select Continue.


3. Update the app and redeploy

You'll make a change to Index.cshtml and redeploy to see the changes. In the .NET 8.0 template, it's in the Pages folder. In the .NET Framework 4.8 template, it's in the Views/Home folder. Follow these steps to update and redeploy your web app:

  1. In Solution Explorer, under your project, open Index.cshtml.
  2. Replace the first <div> element with the following code:

<div class="jumbotron">
    <h1>.Hello World this is my first Dot Net Project</h1>
    <p class="lead">Follow for more tech tips 👉www.garudax.id/in/kumarashutosh-technicalspecialist .</p>
</div>        

Save your changes.

3. To redeploy to Azure, right-click the WebApp project in Solution Explorer and select Publish.

4. In the Publish summary page, select Publish.

When publishing completes, Visual Studio launches a browser to the URL of the web app.


4. Manage the Azure app

To manage your web app, go to the Azure portal, and search for and select App Services.

On the App Services page, select the name of your web app.

The Overview page for your web app contains options for basic management like browse, stop, start, restart, and delete. The left menu provides further pages for configuring your app.



To view or add a comment, sign in

More articles by Ashutosh Kumar

Others also viewed

Explore content categories