|
1 | 1 | ---
|
2 |
| -title: 'QuickStart: Create a C# ASP.NET Core app' |
| 2 | +title: "Quickstart: Create a C# ASP.NET Core app" |
3 | 3 | description: Learn how to run web apps in Azure App Service by deploying the default C# ASP.NET Core web app template from Visual Studio.
|
4 | 4 | ms.assetid: b1e6bd58-48d1-4007-9d6c-53fd6db061e3
|
5 | 5 | ms.topic: quickstart
|
6 |
| -ms.date: 08/30/2019 |
7 |
| -ms.custom: mvc, devcenter, vs-azure |
8 |
| -ms.custom: seodec18 |
9 |
| - |
| 6 | +ms.date: 03/17/2020 |
| 7 | +ms.custom: mvc, devcenter, vs-azure, seodec18 |
10 | 8 | ---
|
11 |
| -# Create an ASP.NET Core web app in Azure |
12 |
| - |
13 |
| -> [!NOTE] |
14 |
| -> This article deploys an app to App Service on Windows. To deploy to App Service on _Linux_, see [Create a .NET Core web app in App Service on Linux](./containers/quickstart-dotnetcore.md). |
15 |
| -> |
16 | 9 |
|
17 |
| -[Azure App Service](overview.md) provides a highly scalable, self-patching web hosting service. |
| 10 | +# Quickstart: Create an ASP.NET Core web app in Azure |
18 | 11 |
|
19 |
| -This quickstart shows how to deploy your first ASP.NET Core web app to Azure App Service. When you're finished, you'll have a resource group that consists of an App Service plan and an App Service app with a deployed web application. |
| 12 | +In this quickstart, you'll learn how to create and deploy your first ASP.NET Core web app to [Azure App Service](overview.md). |
20 | 13 |
|
21 |
| -[!INCLUDE [quickstarts-free-trial-note](../../includes/quickstarts-free-trial-note.md)] |
| 14 | +When you're finished, you'll have an Azure resource group consisting of an App Service hosting plan and an App Service with a deployed web application. |
22 | 15 |
|
23 | 16 | ## Prerequisites
|
24 | 17 |
|
25 |
| -To complete this tutorial, install <a href="https://www.visualstudio.com/downloads/" target="_blank">Visual Studio 2019</a> with the **ASP.NET and web development** workload. |
| 18 | +- An Azure account with an active subscription. [Create an account for free](https://azure.microsoft.com/free/?ref=microsoft.com&utm_source=microsoft.com&utm_medium=docs&utm_campaign=visualstudio). |
| 19 | +- This quickstart deploys an app to App Service on Windows. To deploy to App Service on _Linux_, see [Create a .NET Core web app in App Service on Linux](./containers/quickstart-dotnetcore.md). |
| 20 | +- Install <a href="https://www.visualstudio.com/downloads/" target="_blank">Visual Studio 2019</a> with the **ASP.NET and web development** workload. |
| 21 | + |
| 22 | + If you've installed Visual Studio 2019 already: |
26 | 23 |
|
27 |
| -If you've installed Visual Studio 2019 already: |
| 24 | + - Install the latest updates in Visual Studio by selecting **Help** > **Check for Updates**. |
| 25 | + - Add the workload by selecting **Tools** > **Get Tools and Features**. |
28 | 26 |
|
29 |
| -- Install the latest updates in Visual Studio by selecting **Help** > **Check for Updates**. |
30 |
| -- Add the workload by selecting **Tools** > **Get Tools and Features**. |
31 | 27 |
|
32 | 28 | ## Create an ASP.NET Core web app
|
33 | 29 |
|
34 |
| -Create an ASP.NET Core web app by following these steps: |
| 30 | +Create an ASP.NET Core web app in Visual Studio by following these steps: |
35 | 31 |
|
36 |
| -1. Open Visual Studio and then select **Create a new project**. |
| 32 | +1. Open Visual Studio and select **Create a new project**. |
37 | 33 |
|
38 |
| -1. In **Create a new project**, find and choose **ASP.NET Core Web Application** for C#, then select **Next**. |
| 34 | +1. In **Create a new project**, select **ASP.NET Core Web Application** and confirm that **C#** is listed in the languages for that choice, then select **Next**. |
39 | 35 |
|
40 |
| -1. In **Configure your new project**, name the application _myFirstAzureWebApp_, and then select **Create**. |
| 36 | +1. In **Configure your new project**, name your web application project *myFirstAzureWebApp*, and select **Create**. |
41 | 37 |
|
42 | 38 | 
|
43 | 39 |
|
44 |
| -1. For this quickstart, choose the **Web Application** template. Make sure authentication is set to **No Authentication** and no other option is selected. Select **Create**. |
45 |
| - |
46 |
| -  |
47 |
| - |
48 |
| - You can deploy any type of ASP.NET Core web app to Azure. |
| 40 | +1. You can deploy any type of ASP.NET Core web app to Azure, but for this quickstart, choose the **Web Application** template. Make sure **Authentication** is set to **No Authentication**, and that no other option is selected. Then, select **Create**. |
49 | 41 |
|
50 |
| -1. From the Visual Studio menu, select **Debug** > **Start Without Debugging** to run the web app locally. |
| 42 | +  |
| 43 | + |
| 44 | +1. From the Visual Studio menu, select **Debug** > **Start Without Debugging** to run your web app locally. |
51 | 45 |
|
52 |
| -  |
| 46 | +  |
53 | 47 |
|
54 | 48 | ## Publish your web app
|
55 | 49 |
|
56 |
| -1. In **Solution Explorer**, right-click the **myFirstAzureWebApp** project and select **Publish**. |
| 50 | +To publish your web app, you must first create and configure a new App Service that you can publish your app to. |
57 | 51 |
|
58 |
| -1. Choose **App Service** and then select **Publish**. |
| 52 | +As part of setting up the App Service, you'll create: |
59 | 53 |
|
60 |
| -  |
| 54 | +- A new [resource group](https://docs.microsoft.com/azure/azure-resource-manager/management/overview#terminology) to contain all of the Azure resources for the service. |
| 55 | +- A new [Hosting Plan](https://docs.microsoft.com/azure/app-service/overview-hosting-plans) that specifies the location, size, and features of the web server farm that hosts your app. |
61 | 56 |
|
62 |
| -1. In **App Service Create new**, your options depend on whether you're signed in to Azure already and whether you have a Visual Studio account linked to an Azure account. Select either **Add an account** or **Sign in** to sign in to your Azure subscription. If you're already signed in, select the account you want. |
| 57 | +Follow these steps to create your App Service and publish your web app: |
63 | 58 |
|
64 |
| - > [!NOTE] |
65 |
| - > If you're already signed in, don't select **Create** yet. |
66 |
| - > |
| 59 | +1. In **Solution Explorer**, right-click the **myFirstAzureWebApp** project and select **Publish**. If you haven't already signed-in to your Azure account from Visual Studio, select either **Add an account** or **Sign in**. You can also create a free Azure account. |
67 | 60 |
|
68 |
| -  |
| 61 | +1. In the **Pick a publish target** dialog box, choose **App Service**, select **Create New**, and then select **Create Profile**. |
69 | 62 |
|
70 |
| - [!INCLUDE [resource group intro text](../../includes/resource-group.md)] |
| 63 | +  |
71 | 64 |
|
72 |
| -1. For **Resource group**, select **New**. |
| 65 | +1. In the **App Service: Create new** dialog, provide a globally unique **Name** for your app by either accepting the default name, or entering a new name. Valid characters are: `a-z`, `A-Z`, `0-9`, and `-`. This **Name** is used as the URL prefix for your web app in the format `http://<app_name>.azurewebsites.net`. |
73 | 66 |
|
74 |
| -1. In **New resource group name**, enter *myResourceGroup* and select **OK**. |
| 67 | +1. For **Subscription**, accept the subscription that is listed or select a new one from the drop-down list. |
75 | 68 |
|
76 |
| - [!INCLUDE [app-service-plan](../../includes/app-service-plan.md)] |
| 69 | +1. In **Resource group**, select **New**. In **New resource group name**, enter *myResourceGroup* and select **OK**. |
77 | 70 |
|
78 |
| -1. For the **Hosting Plan**, select **New**. |
| 71 | +1. For **Hosting Plan**, select **New**. |
79 | 72 |
|
80 |
| -1. In the **Configure Hosting Plan** dialog, enter the values from the following table, and then select **OK**. |
| 73 | +1. In the **Hosting Plan: Create new** dialog, enter the values specified in the following table: |
81 | 74 |
|
82 |
| - | Setting | Suggested Value | Description | |
83 |
| - |-|-|-| |
84 |
| - |App Service Plan| myAppServicePlan | Name of the App Service plan. | |
85 |
| - | Location | West Europe | The datacenter where the web app is hosted. | |
86 |
| - | Size | Free | [Pricing tier](https://azure.microsoft.com/pricing/details/app-service/?ref=microsoft.com&utm_source=microsoft.com&utm_medium=docs&utm_campaign=visualstudio) determines hosting features. | |
| 75 | + | Setting | Suggested Value | Description | |
| 76 | + | -------- | --------------- | ----------- | |
| 77 | + | **Hosting Plan** | *myFirstAzureWebAppPlan* | Name of the App Service plan. | |
| 78 | + | **Location** | *West Europe* | The datacenter where the web app is hosted. | |
| 79 | + | **Size** | *Free* | [Pricing tier](https://azure.microsoft.com/pricing/details/app-service/?ref=microsoft.com&utm_source=microsoft.com&utm_medium=docs&utm_campaign=visualstudio) determines hosting features. | |
| 80 | + |
| 81 | +  |
87 | 82 |
|
88 |
| -  |
| 83 | +1. Leave **Application Insights** set to *None*. |
89 | 84 |
|
90 |
| -1. In **Name**, enter a unique app name that includes only the valid characters are `a-z`, `A-Z`, `0-9`, and `-`. You can accept the automatically generated unique name. The URL of the web app is `http://<app_name>.azurewebsites.net`, where `<app_name>` is your app name. |
| 85 | +1. In the **App Service: Create new** dialog box, select **Create** to start creating the Azure resources. |
91 | 86 |
|
92 |
| -  |
| 87 | +  |
93 | 88 |
|
94 |
| -1. Select **Create** to start creating the Azure resources. |
| 89 | +1. Once the wizard completes, select **Publish**. |
95 | 90 |
|
96 |
| -Once the wizard completes, it publishes the ASP.NET Core web app to Azure, and then launches the app in the default browser. |
| 91 | +  |
97 | 92 |
|
98 |
| - |
| 93 | + Visual Studio publishes your ASP.NET Core web app to Azure, and launches the app in your default browser. |
99 | 94 |
|
100 |
| -The app name specified in the **App Service Create new** page is used as the URL prefix in the format `http://<app_name>.azurewebsites.net`. |
| 95 | +  |
101 | 96 |
|
102 | 97 | **Congratulations!** Your ASP.NET Core web app is running live in Azure App Service.
|
103 | 98 |
|
104 | 99 | ## Update the app and redeploy
|
105 | 100 |
|
| 101 | +Follow these steps to update and redeploy your web app: |
| 102 | + |
106 | 103 | 1. In **Solution Explorer**, under your project, open **Pages** > **Index.cshtml**.
|
107 | 104 |
|
108 | 105 | 1. Replace the two `<div>` tags with the following code:
|
109 | 106 |
|
110 | 107 | ```HTML
|
111 | 108 | <div class="jumbotron">
|
112 | 109 | <h1>ASP.NET in Azure!</h1>
|
113 |
| - <p class="lead">This is a simple app that we’ve built that demonstrates how to deploy a .NET app to Azure App Service.</p> |
| 110 | + <p class="lead">This is a simple app that we've built that demonstrates how to deploy a .NET app to Azure App Service.</p> |
114 | 111 | </div>
|
115 | 112 | ```
|
116 | 113 |
|
117 | 114 | 1. To redeploy to Azure, right-click the **myFirstAzureWebApp** project in **Solution Explorer** and select **Publish**.
|
118 | 115 |
|
119 | 116 | 1. In the **Publish** summary page, select **Publish**.
|
120 | 117 |
|
121 |
| -  |
| 118 | +  |
122 | 119 |
|
123 | 120 | When publishing completes, Visual Studio launches a browser to the URL of the web app.
|
124 | 121 |
|
125 |
| - |
| 122 | + |
126 | 123 |
|
127 | 124 | ## Manage the Azure app
|
128 | 125 |
|
129 |
| -To manage the web app, go to the [Azure portal](https://portal.azure.com), and search for and select **App Services**. |
| 126 | +To manage your web app, go to the [Azure portal](https://portal.azure.com), and search for and select **App Services**. |
130 | 127 |
|
131 | 128 | 
|
132 | 129 |
|
133 | 130 | On the **App Services** page, select the name of your web app.
|
134 | 131 |
|
135 |
| - |
136 |
| - |
137 |
| -You see your web app's Overview page. Here, you can do basic management like browse, stop, start, restart, and delete. |
| 132 | + |
138 | 133 |
|
139 |
| - |
| 134 | +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. |
140 | 135 |
|
141 |
| -The left menu provides different pages for configuring your app. |
| 136 | + |
142 | 137 |
|
143 | 138 | [!INCLUDE [Clean-up section](../../includes/clean-up-section-portal.md)]
|
144 | 139 |
|
145 | 140 | ## Next steps
|
146 | 141 |
|
| 142 | +In this quickstart, you used Visual Studio to create and deploy an ASP.NET Core web app to Azure App Service. |
| 143 | + |
| 144 | +Advance to the next article to learn how to create a .NET Core app and connect it to a SQL Database: |
| 145 | + |
147 | 146 | > [!div class="nextstepaction"]
|
148 | 147 | > [ASP.NET Core with SQL Database](app-service-web-tutorial-dotnetcore-sqldb.md)
|
0 commit comments