views:

13

answers:

0

I keep getting this error when trying to connect to an Analysis Services on the same machine the service is running on. If I connect via my desktop I don't see this error. I did quite a bit of googling, haven't found any solutions yet.

When connecting from my desktop I am authenticated over a VPN. I get the feeling this error has something to do with authentication, but am not sure. Any ideas?

Here is how I am trying to connect to the anlaysis service:

        using (var db = new NewsAnalyzerDataContext
                            {
                                CommandTimeout = ConnectionConstants.FiveMinutes
                            })
        {
            var score = new double();
            var mdx = new StringBuilder();

            mdx.Append(
                @"SELECT
              [DW Assertions].[Change]
            From
              [DW Assertions]
            NATURAL PREDICTION JOIN
            (SELECT ");
            foreach (var a in db.Assertions.Where(a => a.StoryID.Equals(request.StoryId)))
                mdx.Append(string.Format("{0} AS [E{1}],",
                                         a.Relevance,
                                         a.EntityID));
            mdx.Append(" null ) AS t");

            string query = mdx.ToString();

            using (var conn = new AdomdConnection
                                  {
                                      ConnectionString = ConnectionString
                                  })
            {
                // Set the connectionstring
                // Creacte a new command
                var cmd = new AdomdCommand
                              {
                                  Connection = conn,
                                  CommandText = query
                              };
                // Assign the connection to the command
                // Assign a query to the commandtext
                // Open the connection
                if (cmd.Connection.State !=
                    ConnectionState.Open)
                    conn.Open();

                // Execute the reader
                AdomdDataReader reader = cmd.ExecuteReader();
                while (reader.Read())
                    // for each item in the resultset, print the value
                    for (int i = 0; i < reader.FieldCount; i++)
                        score = double.Parse(reader.GetValue(i).ToString());
                // Don't forget to close the connection
                //if (Connection.State !=
                //    ConnectionState.Closed)
                conn.Close();
            }

            LoggerService.DebugFormat(GetType(),
                                      "Got score for story ID: {0}, the score is: {1}",
                                      request.StoryId,
                                      score);
            MWS.Database.NewsAnalyzer.Story story = db.Stories.Where(s => s.ID.Equals(request.StoryId)).First();
            story.NeuralNetworkScore = score;
            db.SubmitChanges();
        }

Here is a sample of the connection string I am using:

            <param name="connectionString" parameterType="System.String">
              <value value="Provider=MSOLAP;Data Source=mws1.local;Initial Catalog=MWS NewsAnalysis AnalysisServices;" type="System.String"/>
            </param>

2010-08-29 14:53:41,830 [20] ERROR MWS.Story.Database.Services.NeuralNetworkService - Microsoft.AnalysisServices.AdomdClient.AdomdConnectionException: The connection either timed out or was lost. ---> System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags) at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size) --- End of inner exception stack trace --- at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size) at System.IO.BufferedStream.Read(Byte[] array, Int32 offset, Int32 count) at Microsoft.AnalysisServices.AdomdClient.DimeRecord.ForceRead(Stream stream, Byte[] buffer, Int32 length) at Microsoft.AnalysisServices.AdomdClient.DimeRecord.ReadHeader() at Microsoft.AnalysisServices.AdomdClient.DimeRecord..ctor(Stream stream) at Microsoft.AnalysisServices.AdomdClient.DimeReader.ReadRecord() at Microsoft.AnalysisServices.AdomdClient.TcpStream.GetResponseDataType() --- End of inner exception stack trace --- at Microsoft.AnalysisServices.AdomdClient.XmlaClient.EndRequest() at Microsoft.AnalysisServices.AdomdClient.XmlaClient.CreateSession(ListDictionary properties, Boolean sendNamespaceCompatibility) at Microsoft.AnalysisServices.AdomdClient.AdomdConnection.XmlaClientProvider.Microsoft.AnalysisServices.AdomdClient.AdomdConnection.IXmlaClientProviderEx.CreateSession(Boolean sendNamespaceCompatibility) at Microsoft.AnalysisServices.AdomdClient.AdomdConnection.ConnectToXMLA(Boolean createSession, Boolean isHTTP) at Microsoft.AnalysisServices.AdomdClient.AdomdConnection.Open() at MWS.Story.Database.Services.NeuralNetworkService.ScoreStory(NeuralNetworkScoreRequest request)