azure - 如何将asp.net Core 3.1部署到Azure

标签 azure asp.net-core azure-deployment

我有一个小型 ASP.NET Core 3.1 控制台应用程序,我想将其部署到 Azure。 当我运行此部署命令时:

git Push azure master

我得到以下输出:

........

........

remote: Running deployment command...
remote: Handling .NET Console Application deployment with dotnet.exe.
remote: D:\Program Files (x86)\dotnet\sdk\2.2.109\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets(137,5): error NETSDK1045: The current .NET SDK does not support targeting .NET Core 3.1.  Either target .NET Core 2.2 or lower, or use a version of the .NET SDK that supports .NET Core 3.1. [D:\home\site\repository\ConsoleApp.csproj]
remote: Failed exitCode=1, command=dotnet restore "D:\home\site\repository\ServiceBusWriter.sln"
remote: An error has occurred during web site deployment.
remote:
remote: Error - Changes committed to remote repository but deployment to website failed.
To https://ServicebusToSQL.scm.azurewebsites.net/ServicebusToSQL.git
 * [new branch]      master -> master

根据我收集的输出,远程 Azure 部署环境(显然)也必须是 .NET Core 3.1

什么是正确的推荐或操作,这将迫使 Azure 远程成为 .NET Core 3.1?

最佳答案

Azure 应用服务并非在所有区域都支持开箱即用的 .NET Core 3.1。因此,如果您想使用.NET Core 3.1,则需要启用.NET Core 3.1 SDK扩展。

或者您需要将应用移至 .NET Core 3.1 支持的区域。您可以在 Azure 应用服务中获取有关 .NET Core 支持的详细信息 - https://aspnetcoreon.azurewebsites.net/

或者您需要使用 Docker 中的 Web 应用程序创建应用程序 - https://azure.microsoft.com/en-us/services/app-service/containers/

关于azure - 如何将asp.net Core 3.1部署到Azure,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59803832/

相关文章:

c++ - C++ 应用程序中的 Azure 通知中心?

Azure B2C 自定义策略登录错误

node.js - Azure Web App Bot - OAuth 完成后触发事件

asp.net-core - 如何访问 ASP.NET Core Program.cs 中的 secret

asp.net-core - ASP.NET Core DisplayAttribute 本地化

asp.net-mvc-3 - Azure 部署到新操作系统系列

azure - 我可以在 ASE 中部署持久 Azure Function 吗

azure - Visual Studio 未显示其他帐户的订阅 - 上周刚刚发生

tfs - 升级到 VS2017 后 VSTS 托管构建失败

c# - Azure DevOps 和 Azure Function 部署 : where are my app settings