我正在尝试在一个小型 Web 应用程序中连接到 Azure 分析服务。我想出的代码Microsoft.AnalysisServices.Tabular
是:
Server as_svr = new Server();
String as_conn_str = "Provider=MSOLAP;Data Source=<Server Name>;Integrated Security=SSPI;Persist Security Info=True;";
as_svr.Connect(as_conn_str);
它使用我的 Windows 凭据。
不幸的是,我不断得到:
parsing_wstrust_response_failed: Parsing WS-Trust response failed
更具体地说:
[AdalException: parsing_wstrust_response_failed: Parsing WS-Trust response failed]
Microsoft.IdentityModel.Clients.ActiveDirectory.AuthenticationContext.RunAsyncTask(Task`1 task) +89
Microsoft.IdentityModel.Clients.ActiveDirectory.AuthenticationContext.AcquireToken(String resource, String clientId, UserCredential userCredential) +29
[TargetInvocationException: Exception has been thrown by the target of an invocation.]
System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) +0
System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) +160
System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +101
Microsoft.AnalysisServices.AadAuthenticator.AcquireToken(Uri dataSourceUri, String dataSource, String identityProvider, String tenantId, String userId, String password, UseAdalCacheType useAdalCache) +970
Microsoft.AnalysisServices.XmlaClient.OpenHttpConnection(ConnectionInfo connectionInfo, Boolean& isSessionTokenNeeded) +1120
Microsoft.AnalysisServices.XmlaClient.OpenConnection(ConnectionInfo connectionInfo, Boolean& isSessionTokenNeeded) +405
Microsoft.AnalysisServices.XmlaClient.Connect(ConnectionInfo connectionInfo, Boolean beginSession) +896
Microsoft.AnalysisServices.Core.Server.Connect(String connectionString, String sessionId, ObjectExpansion expansionType) +156
Microsoft.AnalysisServices.Core.Server.Connect(String connectionString) +13
WebApplication1._Default.Button1_Click(Object sender, EventArgs e) in C:\Visual Studio 2017\Projects\FormAuthAD\WebApplication1\Default.aspx.cs:28
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +9720430
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +204
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +12
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +15
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +35
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1639
我也尝试过使用:
Server as_svr = new Server();
String as_conn_str = "Provider=MSOLAP;Data Source=<Server Name>;User ID=<UserID>;Password=<Password>;Persist Security Info=True; Impersonation Level=Impersonate;";
as_svr.Connect(as_conn_str);
它会产生相同的错误。它必须连接到一些安全设置,但我在这个领域没有任何经验。
如果有任何帮助,我将不胜感激。谢谢你。