I tried to connect my c# app to the SQL Server Analysis Services server, to execute some MDX query. The connection is done as follows :
try{
string connetionString;
connetionString = @"Data Source=localhost;Catalog=SalesCubeDB;";
AdomdConnection cnn;
cnn = new AdomdConnection(connetionString);
cnn.Open();
Console.WriteLine("Connection established !!");
}catch(Exception e)
{
Console.WriteLine(e.ToString());
}
This connection throws the following error :
AdomdConnectionException: A connection cannot be made. Ensure that the server is running
I tried Servername instead of 'localhost', I added rules in the firewall for the traffic and also made sure that the Server Browser uses 'Local System'. If somebody has any ideas i will be grateful, THANKS.
Environment : Windows 10 VM, SQL server 19, ADOMD version 19.26.1.2
I solved my issue and this answer to everyone who might stumble on the same issue. The client app is a console app, so I added the following packages :
System.Configuration.ConfigurationManager
Microsoft.ServiceFabric.Services.Remoting
I also added the following to the Connection String (I use Windows authentification) :
persist security info=True;Integrated Security = SSPI;
I also tried connecting using IIS 8,0 and worked perfectly.