【问题标题】:Publish WebApi to Azure when update to .Net 5.0 from .Net Core 3.1从 .Net Core 3.1 更新到 .Net 5.0 时将 Web Api 发布到 Azure
【发布时间】:2021-04-30 13:26:58
【问题描述】:

我今天偶然发现了一个问题。我已经改了

<TargetFramework>netcore3.1</TargetFramework>

<TargetFramework>net5.0</TargetFramework>

我的工作 Azure Pipeline 坏了,但没有明显的错误。 它构建并发布到应用服务,但 API 返回 404。

当我搜索 Stack 和 Net 时,我没有发现类似的问题。

【问题讨论】:

    标签: .net azure migration


    【解决方案1】:

    我发现有些人在 Visual Studio 中使用自包含选项进行发布。 我没有得到它,但试过了,它奏效了! 所以我在 dotnet 发布部分更改了我的 Azure 管道中的一行:

    -c Release -o out -r linux-x64
    

    -c Release -o out -r linux-x64 --self-contained true
    

    它有帮助!

    我不知道为什么,从 MS 文档看来,如果您使用 -r 选项,它应该是默认值 默认情况下它是自包含的。但是如果有人遇到类似的问题,我希望它会有所帮助!

    干杯! 彼得

    【讨论】:

      猜你喜欢
      • 2021-07-18
      • 1970-01-01
      • 1970-01-01
      • 2020-12-04
      • 2020-04-12
      • 2021-05-03
      • 1970-01-01
      • 1970-01-01
      • 2019-09-29
      相关资源
      最近更新 更多