我无法通过 C# 连接到 SSAS,但 excel 工作得很好

I can't connect to SSAS via C# but excel work great

我有一个 excel 文件,其中保存了与 SSIS 的连接并且运行良好。 这个 excel 文件可以在不同用户的所有机器上工作,没有任何问题

我从这个 excel 文件导出连接字符串... 这是 excel 文件中的连接字符串:

Provider=MSOLAP.5;Password=pass1;Persist Security Info=True;User ID=user1;Initial Catalog=catalog1;Data Source=192.168.10.10;Location=192.168.10.10;MDX Compatibility=1;Safety Options=2;MDX Missing Member Mode=Error;Update Isolation Level=2

当我通过 AdomdConnection 在 C# 中使用此连接字符串时抛出异常:

An existing connection was forcibly closed by the remote host.

我重复了一遍:这个连接字符串在 excel 中非常有用,没有任何问题

这是我的代码:

string connectionString = "Provider=MSOLAP.5;Password=pass1;Persist Security Info=True;User ID=user1;Initial Catalog=catalog1;Data Source=192.168.10.10;Location=192.168.10.10;MDX Compatibility=1;Safety Options=2;MDX Missing Member Mode=Error;Update Isolation Level=2";
            AdomdConnection conn = new AdomdConnection(connectionString);
            conn.Open();

因为 SSAS 使用 windows 凭据 我使用 nuget 包临时更改 windows 身份以连接和查询 SSAS 多维数据集数据库... 包裹是:SimpleImpersonation 工作出色

谢谢大家