Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Deploying a plain ASP.NET Core 2.2 Web App in Azure using Web Deploy is throwing an error

I went to publish an ASP.NET Core web application using Azure through the Publish screen in Visual Studio 2017. I used all of the defaults, though my app uses migrations so I had to tell it to run them in the publish profile.

When I try to access the site, however, I get:

The page cannot be displayed because an internal server error has occurred.

I feel like there is something I need to do with the connection string and the ASPNETCORE_ENVIRONMENT variable.

I still have the default appsettings.json and appsettings.Development.jsonthat you get when creating a new ASP.NET Core web app. The appsettings.json is pointing to my local development database, and the appsettings.Development.json is pointing to the Azure database from the publish profile.

Or does the publish profile automatically take care of the connection string and I don't have to do any of the above?

like image 421
Blake Rivell Avatar asked Dec 11 '18 18:12

Blake Rivell


2 Answers

By default ASP.NET Core 2.2 apps are configured to use the new In Process hosting model. This will not be available on Azure in all regions until sometime in December 2018. They mention it here.

The solution for now is to add the following at the top of your web app's .csproj file:

  <PropertyGroup>
    <AspNetCoreModuleName>AspNetCoreModule</AspNetCoreModuleName>
    <AspNetCoreHostingModel>OutOfProcess</AspNetCoreHostingModel>
  </PropertyGroup>
like image 191
Blake Rivell Avatar answered Oct 06 '22 01:10

Blake Rivell


You can check and set your app settings and connection strings in Application settings section of you service:

enter image description here

like image 27
Michael Avatar answered Oct 05 '22 23:10

Michael