Deploying a plain ASP.NET Core 2.2 Web App in Azure using Web Deploy is throwing an error(使用 Web Deploy 在 Azure 中部署普通的 ASP.NET Core 2.2 Web 应用程序会引发错误)
问题描述
我通过 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.json
和 appsettings.Development.json
.appsettings.json
指向我的本地开发数据库,appsettings.Development.json
指向发布配置文件中的 Azure 数据库.
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?
推荐答案
默认情况下,ASP.NET Core 2.2 应用配置为使用新的进程内托管模型.直到 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 应用程序会引发错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:使用 Web Deploy 在 Azure 中部署普通的 ASP.NET Core 2.2 Web 应用程序会引发错误


- WebMatrix WebSecurity PasswordSalt 2022-01-01
- 如何用自己压缩一个 IEnumerable 2022-01-01
- 在哪里可以找到使用中的C#/XML文档注释的好例子? 2022-01-01
- 带有服务/守护程序应用程序的 Microsoft Graph CSharp SDK 和 OneDrive for Business - 配额方面返回 null 2022-01-01
- 输入按键事件处理程序 2022-01-01
- C# 中多线程网络服务器的模式 2022-01-01
- Web Api 中的 Swagger .netcore 3.1,使用 swagger UI 设置日期时间格式 2022-01-01
- MoreLinq maxBy vs LINQ max + where 2022-01-01
- 良好实践:如何重用 .csproj 和 .sln 文件来为 CI 创建 2022-01-01
- C#MongoDB使用Builders查找派生对象 2022-09-04