"
ASP.NET (snapshot 2017) Microsoft documentation and samples

Publish an ASP.NET Core web app to Azure App Service using Visual Studio

By Rick Anderson, Cesar Blum Silveira, and Rachel Appel

See Publish to Azure from Visual Studio for Mac if you are working on a Mac.

Set up

Create a web app

In the Visual Studio Start Page, select File > New > Project…

File menu
File menu

Complete the New Project dialog:

New Project dialog
New Project dialog

In the New ASP.NET Core Web Application dialog:

New Project dialog
New Project dialog

The Change Authentication dialog appears.

New ASP.NET Core Web authentication dialog
New ASP.NET Core Web authentication dialog

Visual Studio creates the solution.

Run the app locally

Web application open in Microsoft Edge on localhost
Web application open in Microsoft Edge on localhost
Internal Server Error: A database operation failed while processing the request. SQL exception: Cannot open the database. Applying existing migrations for Application DB context may resolve this issue.
Internal Server Error: A database operation failed while processing the request. SQL exception: Cannot open the database. Applying existing migrations for Application DB context may resolve this issue.

The app displays the email used to register the new user and a Log out link.

Web application open in Microsoft Edge. The Register link is replaced by the text Hello email@domain.com!
Web application open in Microsoft Edge. The Register link is replaced by the text Hello email@domain.com!

Deploy the app to Azure

Close the web page, return to Visual Studio, and select Stop Debugging from the Debug menu.

Right-click on the project in Solution Explorer and select Publish….

Contextual menu open with Publish link highlighted
Contextual menu open with Publish link highlighted

In the Publish dialog, select Microsoft Azure App Service and click Publish.

Publish dialog
Publish dialog
App Service dialog
App Service dialog
New SQL Database
New SQL Database
New SQL Database and server
New SQL Database and server

The Configure SQL Server dialog appears.

[!NOTE] “admin” is not allowed as the administrator user name.

Configure SQL Server dialog
Configure SQL Server dialog

Visual Studio returns to the Create App Service dialog.

Configure SQL Database dialog
Configure SQL Database dialog
Publish dialog: Connection panel
Publish dialog: Connection panel

On the Settings page of the Publish dialog:

Publish dialog: Settings panel
Publish dialog: Settings panel

Click Publish. Visual Studio will publish your app to Azure and launch the cloud app in your browser.

Test your app in Azure

Web application opened in Microsoft Edge on Azure App Service
Web application opened in Microsoft Edge on Azure App Service

Update the app

Contextual menu open with Publish link highlighted
Contextual menu open with Publish link highlighted
Verify task is complete
Verify task is complete

Clean up

When you have finished testing the app, go to the Azure portal and delete the app.

Azure Portal: Resource Groups in sidebar menu
Azure Portal: Resource Groups in sidebar menu
Azure Portal: Resource Groups page
Azure Portal: Resource Groups page

Next steps



Comments ( )
Link to this page: //www.vb-net.com/AspNet-DocAndSamples-2017/aspnetcore/tutorials/publish-to-azure-webapp-using-vs.htm
< THANKS ME>