AdomdConnectionException This is usually a temporary error during hostname resolution and means that the local server did not receive a response from

  • Thread starter Thread starter bikash shah
  • Start date Start date
B

bikash shah

Guest
Hello,
I am trying to connect to Azure analysis Service using Microsoft.AnalysisServices.AdomdClient.NetCore.retail.amd64 library.

I am using following code to connect to the analysis service and execute my XMLA file.

using (AdomdConnection conn = new AdomdConnection(sTargetServer))
{
conn.Open();
AdomdCommand cmd = conn.CreateCommand();
cmd.CommandText = xmlaFileContents;
cmd.ExecuteNonQuery();
conn.Close();
}

i want to run this code as a different user, so to test locally i am running visual studio code with the user i want to run this code. On line conn.Open() it prompts me to log-in which after successful login executes the xmla file.

The issue is when i run VS normally (not specific user) and try to impersonate the user i want to run the code, i am getting error.
Code:

bool returnValue = LogonUser(uName, domain, pass,
LOGON32_LOGON_INTERACTIVE, LOGON32_PROVIDER_DEFAULT,
out safeAccessTokenHandle);

if (false == returnValue)
{
int ret = Marshal.GetLastWin32Error();
Console.WriteLine("LogonUser failed with error code : {0}", ret);
throw new System.ComponentModel.Win32Exception(ret);
}
Console.WriteLine("Did LogonUser Succeed? " + (returnValue ? "Yes" : "No"));
// Check the identity.
Console.WriteLine("Before impersonation: " + WindowsIdentity.GetCurrent().Name);

// Note: if you want to run as unimpersonated, pass
// 'SafeAccessTokenHandle.InvalidHandle' instead of variable 'safeAccessTokenHandle'
WindowsIdentity.RunImpersonated(safeAccessTokenHandle, () =>
{
// Check the identity.
Console.WriteLine("During impersonation: " + WindowsIdentity.GetCurrent().Name);
using (AdomdConnection conn = new AdomdConnection(sTargetServer))
{
conn.Open();
AdomdCommand cmd = conn.CreateCommand();
cmd.CommandText = xmlaFileContents;
cmd.ExecuteNonQuery();
conn.Close();
}
});


Error when executing conn.Open()

Microsoft.AnalysisServices.AdomdClient.AdomdConnectionException
HResult=0x80131500
Message=This is usually a temporary error during hostname resolution and means that the local server did not receive a response from an authoritative server. This is usually a temporary error during hostname resolution and means that the local server did not receive a response from an authoritative server.
Source=Microsoft.AnalysisServices.AdomdClient
StackTrace:
at Microsoft.AnalysisServices.AdomdClient.ASAzureUtility.ThrowConnectionException(WebException ex, AsInstanceType asInstanceType)
at Microsoft.AnalysisServices.AdomdClient.ASAzureUtility.ResolvePaaSConnectionEndpointDetail(AsInstanceType asInstanceType, Uri dataSourceUri, String paasInfrastructureServerName, String restrictDatabaseName, Boolean premiumPublicXmlaEndpoint, TimeLeft& timeLeft, OnTimeoutAction timeoutAction, Guid parentActivityId)
at Microsoft.AnalysisServices.AdomdClient.ConnectionInfo.ResolveHTTPConnectionPropertiesForPaaSInfrastructure(IConnectivityOwner owner, Uri& dataSourceUri, Boolean acquireAADToken, Boolean returnCloudConnectionAuthenticationProperties, String& paasCoreServerName, CloudConnectionAuthenticationProperties& cloudConnectionAuthenticationProperties)
at Microsoft.AnalysisServices.AdomdClient.ConnectionInfo.AcquireAADTokenAndResolveHTTPConnectionPropertiesForPaaSInfrastructure(IConnectivityOwner owner, Uri& dataSourceUri, String& paasCoreServerName)
at Microsoft.AnalysisServices.AdomdClient.XmlaClient.OpenHttpConnection(ConnectionInfo connectionInfo, Boolean& isSessionTokenNeeded)
at Microsoft.AnalysisServices.AdomdClient.XmlaClient.Connect(ConnectionInfo connectionInfo, Boolean beginSession)
at Microsoft.AnalysisServices.AdomdClient.AdomdConnection.XmlaClientProvider.Connect()
at Microsoft.AnalysisServices.AdomdClient.AdomdConnection.XmlaClientProvider.Microsoft.AnalysisServices.AdomdClient.AdomdConnection.IXmlaClientProviderEx.ConnectXmla()
at Microsoft.AnalysisServices.AdomdClient.AdomdConnection.ConnectToXMLA(Boolean createSession, Boolean isHTTP)
at Microsoft.AnalysisServices.AdomdClient.AdomdConnection.Open()


Kindly help resolve the issue.

Regards,

Bikash Shah

Continue reading...
 
Back
Top