Search code examples
c#ssas

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


I have a excel file with saved connection to SSIS and work great. this excel file work on all machine with different user and don't any problem

I export connection string from this excel file ... this is Connection string in excel file :

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

when I use this connection string in C# via AdomdConnection throw Exception :

An existing connection was forcibly closed by the remote host.

I repeated : this connection string work like a charm in excel without any problem

this is my Code :

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();

Solution

  • because SSAS use windows credential i use nuget package to temporary change windows identity to connect and query to SSAS cube database ... the package is : SimpleImpersonation and work great

    thank all