使用Web Deploy在Azure中部署普通的ASP.NET Core 2.2 Web App会引发错误 [英] Deploying a plain ASP.NET Core 2.2 Web App in Azure using Web Deploy is throwing an error

查看:64
本文介绍了使用Web Deploy在Azure中部署普通的ASP.NET Core 2.2 Web App会引发错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我去通过Visual Studio 2017中的 Publish 屏幕使用Azure发布ASP.NET Core Web应用程序.我使用了所有默认值,尽管我的应用程序使用迁移功能,所以我不得不告诉它在发布配置文件中运行它们.

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.

我觉得我需要对连接字符串和ASPNETCORE_ENVIRONMENT变量做些事情.

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

在创建新的ASP.NET Core Web应用程序时,我仍然拥有默认的appsettings.jsonappsettings.Development.json. appsettings.json指向我的本地开发数据库,​​而appsettings.Development.json指向发布配置文件中的Azure数据库.

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?

推荐答案

默认情况下,ASP.NET Core 2.2应用程序配置为使用新的In Process托管模型.直到2018年12月某个时候,该功能才在所有地区的Azure上提供.他们提到它

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.

目前的解决方案是在Web应用程序的.csproj文件顶部添加以下内容:

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>

这篇关于使用Web Deploy在Azure中部署普通的ASP.NET Core 2.2 Web App会引发错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆