【发布时间】:2021-07-23 13:58:05
【问题描述】:
我目前正在开发一个连接到 odbc 驱动程序的 azure 函数。我有一个本地称为“Dobbe WMS productie”,我正在使用以下代码连接到它。
using(odbcConnection conn = new OdbcConnection("DSN=Dobbe WMS productie"))
{
conn.Open();
// performs some actions
conn.Close();
}
在本地这工作得很好。现在我将它发布到 azure 并且它无法正常工作,正如我所料。问题是,我找不到任何东西来解决我的问题。有没有人可以帮助我解决这个问题?
编辑:
我的完整错误消息:ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified.
我在 windows -> System-DSN -> add 上打开了 ODBC-datasources,然后选择 postgresql ansi 驱动程序。填写表格中的基本信息并点击保存
我也尝试过 Npgsl 并得到以下错误: The remote certificate is invalid according to the validation procedure. 我的连接字符串看起来像这样:Server=address;Port=5432;Database=dbname;User Id=username;Password=password;SslMode=Require
【问题讨论】:
-
I cant find anything to solve my issue你部署驱动了吗?您是否创建了数据源?你得到了什么错误? -
您好@PanagiotisKanavos,感谢您的快速回复!我还没有做任何事情,比如部署它。如果您参考了一些文档,我将不胜感激。也看看编辑
-
嗯,你读过错误的内容吗?您希望如何连接到不存在的数据源?
a reference to some documentation你是如何在你的机器上设置数据源的? -
@PanagiotisKanavos 我知道它在说什么。我预计会出现这样的错误,因为我有本地驱动程序。但我不知道从哪里开始才能从 azure 访问它
标签: c# azure azure-functions