从 UWP 应用程序连接到 Postgres 数据库时出错

比绍伊

尝试使用 Npgsql 从 UWP 应用程序连接到 Postgres 数据库并在加载以下程序集时出错:

"System.Net.Security, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"

这是确切的例外:

{System.IO.FileNotFoundException: Could not load file or assembly 'System.Net.Security, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
File name: 'System.Net.Security, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
   at Npgsql.NpgsqlConnector.<RawOpen>d__139.MoveNext()
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[TStateMachine](TStateMachine& stateMachine)
   at Npgsql.NpgsqlConnector.RawOpen(NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken)
   at Npgsql.NpgsqlConnector.<Open>d__136.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
   at Npgsql.ConnectorPool.<AllocateLong>d__24.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.ValueTaskAwaiter`1.GetResult()
   at Npgsql.NpgsqlConnection.<Open>d__24.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Npgsql.NpgsqlConnection.Open()
   at ... >>> here goes my code
谢伊·罗扬斯基

这是一个已知问题,请参阅https://github.com/npgsql/npgsql/issues/820

不幸的是,在 UWP 支持 netstandard20 之前,您将有几个月的时间,届时这种情况将消失。

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

无法将应用程序连接到数据库

演示Springboot应用程序连接到Postgres数据库引发运行时嵌套异常

如何从Windows 10 UWP应用连接到SQL Server数据库

将Django连接到Google App Engine中的Google CloudSQL Postgres数据库时出错

在Node.js中连接到Heroku Postgres数据库时出错

连接数据库时出错

如何使用UWP连接到数据库?

Heroku上的数据库连接错误:将Web应用程序连接到Postgresql

无法从我的Django Web应用程序连接到Amazon RDS Postgres数据库

从Spring Boot应用程序连接到本地MySQL数据库时出错

使用nodejs连接到Postgres数据库时出错,导致pg.js“不支持方言postgres”

通过节点js应用程序在openshift中连接到mysql数据库时出错

与数据库连接时出错

将一个应用程序连接到另一个应用程序的数据库时出错

建立数据库连接时出错

连接到MYSQL数据库错误(UWP C#)

在 Windows Phone 8.1 应用程序中连接到 SQLite 数据库时出错

连接到 postgres 数据库

进行数据库查询时,我的 UWP 应用程序冻结了几秒钟

从 Node.js 应用程序连接到通过 Amazon 上的 RDS 托管的 postgres 时出现超时错误

如何使用 UWP 连接到 mySQL 数据库

应用程序容器未正确连接到部署中的 postgres 数据库

如何将本地 node.js 应用程序连接到 Heroku Postgres 数据库?

Sequelize 在连接到 heroku postgres 数据库时卡住了

使用 Cloud SQL PostgreSQL DB 的 Cloud Run 上的 Django 应用程序出错 - 无法连接到数据库

Dash 应用程序连接到 AWS postgres 数据库非常慢

如何将本地托管的 Django 应用程序连接到 Dockerized Postgres 数据库

如何将 UWP 类库链接到 WPF 应用程序?

我在 heroku 上部署了我的应用程序,但在运行 heroku 日志时出现此错误日志尾部“连接到数据库时出错”