Search code examples
c#asp.netssasadomd.net

SSAS ADOMD connection forcly closed


I built a web application (c# ASP.Net 4.0). Within this app I want to connect to an SSAS Cube (SQL Server 2017)

using (AdomdConnection connection = new AdomdConnection(connectionString))
{
    AdomdCommand command = new AdomdCommand(query, connection)
    {
        CommandTimeout = connection.ConnectionTimeout
    };
    AdomdDataAdapter mdAdapter = new AdomdDataAdapter(command);
    connection.Open();
    result = (CellSet)command.Execute();
    connection.Close();
}

If i start the application on my local development machine, the connection works. When I deploy the application to an IIS (version 6.2 / Server 2012 R2) and browse to the site I get this error.

Message : Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.

I checked the connection by using an SQL Management-Studio on the Web-Server. I use local windows-user on DB-host for login to SSAS. Everything works fine (connection, MDX).

my connection-String:

 <add name="MyConnection" connectionString="Provider=MSOLAP;Persist Security Info=True;Update Isolation Level=2;User ID= XXX ;Password= XX;Data Source= My DB-HOST:SSAS-Port;Catalog=My SSAS-CUBE;"/>

Maybe you have any idea, how i can get more information abut this issue?

Thx, Regards Thomas


Solution

  • connectionString="Provider=MSOLAP;Persist Security Info=True;Update Isolation Level=2;User ID= XXX ;Password= XX;Data Source= My DB-HOST:SSAS-Port;Catalog=My SSAS-CUBE;"

    SSAS only supports Windows Integrated Auth (or HTTP Basic via the data pump). So you can take the User ID and Password out of the connection string, and grant the IIS App Pool Identity access to the cube (assuming you're not impersonating). If you are impersonating, you'll need to get Kerberos Constrained Delegation working unless SSAS is running on the same server as IIS.

    If you use any of the local, automatic identities for the App Pool you would use the machine account to grant access to remote resources. SO if your IIS server is called MyDomain\MyServer, then grant access to MyDomain\MyServer$.