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.json
that 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?
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>
You can check and set your app settings and connection strings in Application settings
section of you service:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With