【问题标题】:Deploying Web API to Azure - Entity Framework Core migrations connection string not being picked up将 Web API 部署到 Azure - Entity Framework Core 迁移连接字符串未被拾取
【发布时间】:2022-06-15 04:27:40
【问题描述】:

我正在尝试使用 Visual Studio 2022 将我的 Web API 部署到 Azure 应用服务,但是当我尝试应用迁移时,虽然它发现了数据库上下文,但它并没有发现连接字符串:

这是我的数据库上下文类的代码:

namespace MyPortfolioWebAPI.Data
{
    public class MyPortfolioContext:DbContext
    {
        public MyPortfolioContext(DbContextOptions<MyPortfolioContext> options) : base(options)
        {
        }

        public DbSet<Emails> Emails { get; set; } = null!;
        public DbSet<Projects> Projects { get; set; } = null!;
    }
}

这是我的appsettings.json 文件:

它在我的本地机器上运行良好,但我正在尝试将它发布到 Azure。

【问题讨论】:

  • 我想添加连接字符串来手动发布应用此迁移还是应该像我想的那样自动生成它

标签: c# azure asp.net-core asp.net-core-webapi


猜你喜欢
  • 2018-05-08
  • 1970-01-01
  • 2018-03-20
  • 1970-01-01
  • 2021-09-20
  • 1970-01-01
  • 2023-03-28
  • 1970-01-01
  • 2020-02-20
相关资源
最近更新 更多