Running ASP.NET Core 5 RC applications on Azure App Service

Although .NET 5 is officially in RC and not yet officially supported on Azure cloud we can still deploy ASP.NET Core web applications built for .NET 5 to Azure App Services. I made my first ASP.NET Core 5.0 deployment to Azure App Service this week. There has been no problems on Azure side and my application is running very stable. Here’s how I did it.

Prerequisites

To try ASP.NET Core on .NET 5 and Azure App Service out you need the following things:

For testing I strongly recommend to go with clean App Service Plan and App Service to not affect any live systems you have. After you are done with prerequisites it’s time to create test application.

Creating web application

Run Visual Studio 2019 Preview and create new ASP.NET Core Web Application. Here’s the screenshot with settings I used.

Create new ASP.NET Core 5 application

After creating web application you should see classic ASP.NET Core project structure in Visual Studio.

Default ASP.NET Core 5 application in Visual Studio

Run your application to make sure there are no issues with Visual Studio 2019 Preview or .NET Core 5. You should see default ASP.NET Core application in your browser.

Default ASP.NET Core 5.0 application in browser

If there were no issues with application and tooling then let’s publish it to Azure cloud.

Publishing ASP.NET Core 5 application to App Service

Right click on your ASP.NET Core 5 project in Visual Studio 2019 Preview and select publish. Follow these steps:

  1. Select Azure as publishing target and click Next
  2. Select Azure App Service as specific target and click Next
  3. From Azure app service instances list select the instance you created and click Finish

Visual Studio creates publishing profile and opens it automatically.

ASP.NET Core 5 publishing window

Click on pen icon after Deployment mode field and select Self-contained as deployment mode. By default target runtime is changed to win-x86. You can leave it like it is but you can also switch over to win-x64. Click Save when done. This is how publishing window should look like after these changes.

ASP.NET Core 5 application is published as self-contained application

And there’s only one thing left to do – click Publish button. After publishing Visual Studio will automatically open your application in new browser window.

NB! If you once published application to App Service then next times publishing may fail. Sometimes there is error about no permissions to write over your application files. If this error comes then just restart your App Service and try again. Make sure you don’t click anywhere in browser window where your application is opened as it will load libraries again.

References

Gunnar Peipman

Gunnar Peipman is ASP.NET, Azure and SharePoint fan, Estonian Microsoft user group leader, blogger, conference speaker, teacher, and tech maniac. Since 2008 he is Microsoft MVP specialized on ASP.NET.

    One thought on “Running ASP.NET Core 5 RC applications on Azure App Service

    Leave a Reply

    Your email address will not be published. Required fields are marked *