2017-01-19 4 views
1

雲のデプロイ済みモデルからADOMD.NETを使用してAzure Analysis Servicesからデータを取得しようとしています。コードスニペットは以下のとおりですが、ConnectionStringが無効であるというエラーが表示されます。ADOMD.NETを使用してAzure分析に接続しているときに接続文字列エラーが発生しました

using Microsoft.AnalysisServices.AdomdClient; 
using System; 
using System.Collections.Generic; 
using System.Data; 
using System.Linq; 
using System.Text; 
using System.Threading.Tasks; 

namespace Test_Analysis_Service_retrieval 
{ 
    class Program 
    { 
     static void Main(string[] args) 
     { 
      string queryString = @"SELECT [MAP_CUST_NAME] FROM [AAS_MAPLOOKUP] where [MAP_ACT_NO] = '120000810';"; 
      string connectionString = @"Data Source=asazure://westus.asazure.windows.net/bbacloud;[email protected];[email protected];"; 

      using (AdomdConnection connection = new AdomdConnection(connectionString)) 
      { 
       CellSet AASOutput = null; 
       System.Xml.XmlReader reader = null; 
       try 
       { 
        string s = connection.ConnectionString; 
        Console.WriteLine(s); 
        connection.Open(); 
        AdomdCommand command = new AdomdCommand(queryString, connection); 
        command.CommandTimeout = 100000; 
        reader = command.ExecuteXmlReader(); 
        Console.WriteLine(reader.ReadOuterXml()); 
       } 
       catch(Exception e) 
       { 
        Console.WriteLine(e.Message); 
       } 
       finally 
       { 
        if (reader != null) 
        { 
         reader.Close(); 
        } 
        connection.Close(); 
       } 
      } 
     } 
    } 
} 
+0

これは修正されましたか? – Unnie

答えて

0

最初に行う必要があるのは、最新のADOMD.NET(AdomdClient)がインストールされていることを確認することです。 hereからダウンロードしてください。

string connectionString = @"Data Source=asazure://westus.asazure.windows.net/bbacloud;User [email protected];Password=pwdHere;Initial Catalog=DatabaseNameHere"; 

注いくつかのことを:

C:\Windows\Microsoft.NET\assembly\GAC_MSIL\Microsoft.AnalysisServices.AdomdClient\v4.0_13.0.0.0__89845dcd8080cc91\Microsoft.AnalysisServices.AdomdClient.dll

次に、あなたがあなたの接続文字列を変更する必要があります:あなたはそれをインストールした後は、その後、あなたのC#プロジェクトがで、それへの参照を持っていることを確認してください。まず、UserNameではなくUser IDです。次に、ユーザーはAzure Active Directoryユーザー(個人アカウントではなく組織アカウント)である必要があります。最後に、複数のデータベースを展開した場合に備えて、正しいデータベースに確実に接続するために、初期カタログを指定する必要があります。

0

この問題は、RTMバージョンのAdomdClientが実際にAzure Analysis ServicesのRTMバージョンをサポートしていないことが原因であることが判明しました。その結果、以下のNugetパッケージが必要です。

https://github.com/ogaudefroy/Unofficial.Microsoft.AnalysisServices.AdomdClient

削除/ Microsoft.AnalysisServices.AdomdClient.12.0.2000.8のバージョン12(RTM版)をアンインストールし、AdomdClientのすべての作品の上にインストールしたら、ちょうど良い。要するに、v12バージョンには、asazure://データソースを解析するためのコードは組み込まれていません。

Microsoftのサイトや問題のサポートに関する文書はまったく迷惑です。しかし、これはあなたの質問に対処します。

関連する問題