Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
213 views
in Technique[技术] by (71.8m points)

c# - 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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...