首页 > 解决方案 > ASP.NET 核心 + Heroku。数据库迁移

问题描述

我想使用 ASP.NET Core 中的迁移来更新 Heroku 上的数据库。我使用了正确的连接字符串(DATABASE_URL),但是当我 update-database 从包管理器控制台运行命令时,我收到消息 Format of the initialization string does not conform to specification starting at index 0.

我将在此处保留连接字符串格式: postgres://odb...:5670...@ec2-54-243-54-6.compute-1.amazonaws.com:5432/2d...

标签: databaseherokuasp.net-coremigration

解决方案


我以为DATABASE_URL格式很好,其实不然,你需要使用Server=myServerAddress;Database=myDataBase;User Id=myUsername;Password=myPassword;, PLUS 最后我传递了两个额外的参数:Sslmode=Require;Trust Server Certificate=true.


推荐阅读