使用appsetting.json的npgsql字符串连接

时间:2019-07-25 21:03:46

标签: c# npgsql

我已经尝试使用此连接字符串,并且它可以正常工作。

viewable_by

现在我正在尝试将连接字符串迁移到设置 json 具有这种结构

optionsBuilder.UseNpgsql("Host={myhostdirection};Database={dbname}; Username{username}
;Password={password}");

并在 DefaultConnection 中期望数据源参数时引发错误。

但是我尝试在下一个网址中使用不同的连接格式,并且无法正常工作并处理相同的消息。

PostgreSQL connections strings

Npgsl connections string

这就是我用凭据调用js的方式

{
  "AppSettings": {
    "Secret": "THIS IS USED TO SIGN AND VERIFY JWT TOKENS, REPLACE IT WITH YOUR OWN SECRET, IT CAN BE ANY STRING"
  },
  "Logging": {
    "LogLevel": {
      "Default": "Warning"
    }
  },
  "ConnectionStrings": {
    "DefaultConnection": "Host={myhostdirection};Database={dbname}; Username{username}
    ;Password={password}"
  },
  "AllowedHosts": "localhost"
}.

感谢您的光临。

0 个答案:

没有答案
相关问题