1

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();
Tony Stark
  • 434
  • 4
  • 13
abbas-h
  • 392
  • 1
  • 4
  • 18
  • 3
    SSIS is SQL Server Integration Services. SSAS is SQL Server Analysis Services - so you should probably re-tag your question. Analysis Services only allows Windows Authentication, I believe, so actually your User ID and Password in the connection string would essentially be ignored. This is why Excel is probably fine, because it's passing through the credentials of the Windows user. Your C# app is likely not doing the same thing - particularly if it's a web-based app, rather than a Windows form app (however, you don't specify which of these it is - you just say C# is the language) – Craig Jun 16 '21 at 05:05
  • 3
    I'd also suggest there's probably no particular need to tag Excel - there's nothing about your question that poses any kind of issue relating to Excel. The tag should be helpful for others to know that the tag relates to the topic of the question – Craig Jun 16 '21 at 05:06
  • @Craig tag fixed ... thanks ... so how i temporary change identity in C# to use specific windows user ? – abbas-h Jun 16 '21 at 05:25
  • 2
    *change identity in C# to use specific windows user* - it's called impersonation, see https://stackoverflow.com/a/125356/495455 – Jeremy Thompson Jun 16 '21 at 05:31

1 Answers1

0

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

abbas-h
  • 392
  • 1
  • 4
  • 18