In this recipe, we will create a web application and deploy it to Azure.
We will use Visual Studio 2017 Community Edition, and create a web application using the ASP.NET Core templates in Visual Studio.
- First, let's create a new project by clicking
New | Project | ASP.NET Core Web Application | Web application
to create a web application running with ASP.NET Core:
Note
When you run a web application in Visual Studio 2017, you have the choice to develop, debug, and deploy a web application in two different runtime versions, which have themselves two versions for the processor architecture as follows:
- CLR x86 (.NET 4.6 in 32 bits, only for Windows)
- CLR x64 (.NET 4.6 in 64 bits, only for Windows)
- CoreCLR x86 (.NET Core in 32 bits, cross-platform)
- CoreCLR x64 (.NET Core in 64 bits, cross-platform)
- Let's do our first deployment by creating a website on Azure. To do that, right-click on the root of the project and select
Publish...
. - The
Publish Web
dialog box will open:
- Click
Microsoft Azure App Service
. TheCreate App Service
dialog box will open:
- We have to give an
App Name.
- Select the
Subscription.
- Select an
App Service Plan
, or create one. - Select a
Resource Group
(optional). - Select a
Region
(optional). - Select or create a
Database Server
(optional).
- Now the
Create
button is enabled, we click on it:
In the preceding screenshot, we can see a preview of the deployed files.
- Click
Publish
:
In the preceding screenshot, we can see the result of the build and the publishing in the output window.
In the following screenshot, we can see how our web application deployed on Azure:
Take a look at the screenshot below. We can see the publish settings for the web application in the PublishProfiles
folder as one .pubxml
file.