我是 azure 分析服务的新手,并尝试使用AdomdClient
. 我从这里下载了最新的客户端库:
https://docs.microsoft.com/en-us/azure/analysis-services/analysis-services-data-providers
我尝试了什么:
- 安装必要的 SQL Server Data Tools 后,我可以从 SSMS 连接到模型。
- 我可以使用对客户端库的引用在没有其他依赖关系的简单 WebApi 中连接和查询而没有任何问题
Microsoft.IdentityModel.Clients.ActiveDirectory
当项目依赖于高于 2.8 的版本时,我无法连接和查询
但是,在连接到 C# 中的实例时
using (var conn
= new Microsoft.AnalysisServices.AdomdClient.AdomdConnection(
ConfigurationManager.ConnectionStrings["dax"].ConnectionString))
{
conn.Open();
conn.Close();
}
我收到以下错误:
"Message": "An error has occurred.",
"ExceptionMessage": "Authentication failed: Microsoft.IdentityModel.Clients.ActiveDirectory failed to load 'Microsoft.IdentityModel.Clients.ActiveDirectory.PromptBehavior type'.",
"ExceptionType": "Microsoft.AnalysisServices.AdomdClient.AdomdConnectionException",
"StackTrace": "
at Microsoft.AnalysisServices.AdomdClient.AdalRuntimeLibrary.LoadAndValidateType(Assembly assembly, String typeName)
at Microsoft.AnalysisServices.AdomdClient.AdalRuntimeLibrary.LoadAuthenticationContextTypes(Assembly assembly)
at Microsoft.AnalysisServices.AdomdClient.AdalRuntimeLibrary..ctor()
at Microsoft.AnalysisServices.AdomdClient.AdalRuntimeLibrary.get_Instance()
at Microsoft.AnalysisServices.AdomdClient.AadAuthenticator.AcquireToken(Uri dataSourceUri, String dataSource, String identityProvider, String userId, String password, Boolean useAdalCache)
at Microsoft.AnalysisServices.AdomdClient.XmlaClient.OpenHttpConnection(ConnectionInfo connectionInfo, Boolean& isSessionTokenNeeded)
at Microsoft.AnalysisServices.AdomdClient.XmlaClient.OpenConnection(ConnectionInfo connectionInfo, Boolean& isSessionTokenNeeded)
at Microsoft.AnalysisServices.AdomdClient.XmlaClient.Connect(ConnectionInfo connectionInfo, Boolean beginSession)
at Microsoft.AnalysisServices.AdomdClient.AdomdConnection.XmlaClientProvider.Connect(Boolean toIXMLA)
at Microsoft.AnalysisServices.AdomdClient.AdomdConnection.ConnectToXMLA(Boolean createSession, Boolean isHTTP)
at Microsoft.AnalysisServices.AdomdClient.AdomdConnection.Open()
at ...
- 经过一点点挖掘,我们一群人意识到 AdomdClient dll 引用了 dll 中的嵌入式 ActiveDirectory dll,该 dll 引用了 2.8 版。*
- 我无法将版本降低到,
Microsoft.IdentityModel.Clients.ActiveDirectory
因为我使用的很少有 nuget 明确地将最低版本限制为 3.x,这肯定会改变Microsoft.IdentityModel.Clients.ActiveDirectory.PromptBehavior
错误中出现的内容。
有没有解决的办法 ?