如何为我的.net核心Web API在Heroku上配置Postgres

问题描述 投票:-1回答:1

我已经在Heroku上成功部署了.net核心Web API,但是该应用无法启动。当我尝试运行该应用程序时,出现以下错误:错误R10(引导超时)-> Web进程在启动后60秒内未能绑定到$ PORT

这是我的.net核心代码的连接字符串

"ConnectionStrings": {
"DromiContext": "User=user;Password=password;Host=host;Port=5432;Database=database;Integrated Security=true;Pooling=true;"

}

相关问题Heroku + node.js error (Web process failed to bind to $PORT within 60 seconds of launch)

asp.net-web-api heroku-postgres
1个回答
0
投票

该应用未配置为自动运行迁移。更新之后

`

using (var serviceScope = services.BuildServiceProvider().GetService<IServiceScopeFactory>().CreateScope())
            {
                var context = serviceScope.ServiceProvider.GetRequiredService<DromiContext>();
                context.Database.Migrate();
            }

`

错误消失

© www.soinside.com 2019 - 2024. All rights reserved.