Phil Whittington Phil Whittington - 1 month ago 9
C# Question

AdomdConnection throwing "Check that 'SQL Browser' service is running" error

I have the following code that I am trying to get working:-

using (AdomdConnection conn = new AdomdConnection(_connString))
{
conn.Open();

Console.WriteLine(conn.ConnectionString);
Console.WriteLine(conn.Cubes.Count);
}


The following error is thrown with and without the
conn.Open()
line:-

A connection cannot be made to redirector. Ensure that 'SQL Browser' service is running.


I don't have a SQL Browser service available on the client machine I'm using. But what's vexing me is this exact same connection string works from Excel and pulls back a set of OLAP Cube measures which I can pivot as required.

The connection string is as follows:-

Provider=MSOLAP.4;Integrated Security=SSPI;Persist Security Info=True;Initial Catalog=RaptorMarketRiskSummary;Data Source=ssasp-raptor\plnqic01_as;MDX Compatibility=1;Safety Options=2;MDX Missing Member Mode=Error


Does anyone have any ideas?

Many thanks.

Answer

It turns out that this error

A connection cannot be made to redirector. Ensure that 'SQL Browser' service is running

can be caused by problems which have nothing to do with whether the SQL Browser is running or not. (This is intuitively the case given that I could connect from Excel.)

At my workplace each employee has a personal space on a network drive. Because I intended my app to be a quick proof-of-concept to demonstrate .Net's ability to connect to OLAP cubes, I used a folder on my personal network drive as a scratch area. I then tried connecting to another database (directly, not through a cube) and discovered I had a permission issue. I compiled the binary (from Visual Studio) and placed it on another network drive so that a colleague could test from his machine. In checking the binary would throw an error, I ran it from the second network drive and it connected fine and brought back some data.

Changing the app back to connect to my OLAP cube and moving the Visual Studio solution to my local C: drive has resulted in being able to connect to the cube fine and pull back the data I want!

So: the 'Check SQL Browser service is running' error is a catch-all piece of advice which covers a multitude of sins underneath. Permissions can depend on where the app is running from (i.e. which network drive, not just whether the drive is network or local).

Hope this helps :)

Comments