我是azure分析服务的新手,并尝试使用AdomdClient
进行查询。我从这里下载了最新的客户端库:
https://docs.microsoft.com/en-us/azure/analysis-services/analysis-services-data-providers
我尝试了什么:
Microsoft.IdentityModel.Clients.ActiveDirectory
但是在连接到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 ...
Microsoft.IdentityModel.Clients.ActiveDirectory
,因为我使用的少数几个nuget明确地将最低版本限制为3.x,这肯定会改变错误中出现的Microsoft.IdentityModel.Clients.ActiveDirectory.PromptBehavior
。有解决方法吗?
答案 0 :(得分:1)
我有一个类似的问题。我的解决方案中的其他项目引用的ActiveDirectory版本> 3.0,而AdomdClient需要的<2.8。在app.config中添加如下所示的绑定重定向可解决我的问题。这将使其他dll使用Active Directory的> 3.0版本,但AdomdClient可以使用2.8.x
<dependentAssembly>
<assemblyIdentity name="Microsoft.IdentityModel.Clients.ActiveDirectory" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="3.0.0.0-3.19.8.16603" newVersion="3.19.8.16603" />
</dependentAssembly>