[英]FileNotFoundException when connecting to Postgres database
当我尝试连接到我的 postgres 数据库时收到fileNotFoundException 。 她是代码示例。
connectionString = "Server=127.0.0.1;Port=5432;Database=MMEData;User Id=postgres;Password=nH9Ummg5;";
dbConn = new NpgsqlConnection(connectionString); //This constructor is when I get the exception
这是我得到的例外:
{“文件或程序集名称 Mono.Security 或其依赖项之一未找到。Mono.Security,Version=4.0.0.0,Culture=neutral,PublicKeyToken=0738eb9f132ed756”}
npsql.dll
文件复制到应用程序的目录,然后引用它。我同时运行 pgAdmin III,并在其中连接了服务器。 数据库名称是 MMEData。
我在同一台(本地)机器和默认端口(5432)上运行应用程序和 postgres。
有人知道我错过了什么吗?
请在项目解决方案中添加名为Mono.Security dll的引用名称,这样可以避免此类错误
您需要将Mono.Security.dll库复制到应用程序的目录中,然后对其进行引用。
我遇到了同样的问题,我的解决方案是添加 Mono.security.dll 作为对我项目的引用,之后与 PostgreSQL 数据库的连接正常。 我下载了nuget package,我改名为zip文件。 我将 Mono.security.dll 提取到我的项目中。 我将其添加为始终复制到目录的参考。 我编译了我的项目并运行它,没问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.