Quantcast
Channel: Service Bus forum
Viewing all articles
Browse latest Browse all 1916

Service bus queue connection issue

$
0
0

Hi I am having trouble connecting to a pair of ACS Queues from an aspx page, the code and queues work fine from a console application but when referencing the assembly and running the relevant parts via my aspx page I get the following exception:

System.TimeoutException was unhandled by user code
  HResult=-2146233083
  Message=The timeout elapsed upon attempting to obtain a token while accessing 'https://mymdmconnector3-sb.accesscontrol.windows.net/WRAPv0.9/'.
  Source=Microsoft.ServiceBus
  StackTrace:
    Server stack trace:
    Exception rethrown at [0]:
       at Microsoft.ServiceBus.Common.ExceptionDispatcher.Throw(Exception exception)
       at Microsoft.ServiceBus.Common.AsyncResult.End[TAsyncResult](IAsyncResult result)
       at Microsoft.ServiceBus.Common.AsyncResult`1.End(IAsyncResult asyncResult)
       at Microsoft.ServiceBus.TokenProviderHelper.EndGetAccessTokenCore(IAsyncResult result, String& expiresIn, String& audience)
       at Microsoft.ServiceBus.TokenProviderHelper.EndGetAccessTokenByAssertion(IAsyncResult result)
       at Microsoft.ServiceBus.SharedSecretTokenProvider.OnEndGetToken(IAsyncResult result, DateTime& cacheUntil)
       at Microsoft.ServiceBus.TokenProvider.GetTokenAsyncResult.OnEndTokenProviderCallback(IAsyncResult result, DateTime& cacheUntil)
       at Microsoft.ServiceBus.TokenProvider.GetTokenAsyncResultBase`1.OnCompletion(IAsyncResult result)
       at Microsoft.ServiceBus.TokenProvider.GetTokenAsyncResultBase`1.<GetAsyncSteps>b__f(T thisPtr, IAsyncResult r)
       at Microsoft.ServiceBus.Messaging.IteratorAsyncResult`1.StepCallback(IAsyncResult result)
    Exception rethrown at [1]:
       at Microsoft.ServiceBus.Common.ExceptionDispatcher.Throw(Exception exception)
       at Microsoft.ServiceBus.Common.AsyncResult.End[TAsyncResult](IAsyncResult result)
       at Microsoft.ServiceBus.Common.AsyncResult`1.End(IAsyncResult asyncResult)
       at Microsoft.ServiceBus.TokenProvider.EndGetToken(IAsyncResult result)
       at Microsoft.ServiceBus.TokenProviderUtility.GetMessagingToken(TokenProvider tokenProvider, Uri namespaceAddress, String appliesTo, String action, Boolean bypassCache, TimeSpan timeout)
       at Microsoft.ServiceBus.Messaging.Sbmp.SbmpMessageCreator.GetAuthorizationToken(String appliesTo, String action)
       at Microsoft.ServiceBus.Messaging.Sbmp.SbmpMessageCreator.GetAuthorizationHeader(String action)
       at Microsoft.ServiceBus.Messaging.Sbmp.SbmpMessageCreator.CreateWcfMessageInternal(String action, Object body, Boolean includeToken, String parentLinkId, RetryPolicy policy, TrackingContext trackingContext, RequestInfo requestInfo)
       at Microsoft.ServiceBus.Messaging.Sbmp.SbmpMessageCreator.CreateWcfMessage(String action, Object body, String parentLinkId, RetryPolicy policy, TrackingContext trackingContext, RequestInfo requestInfo)
       at Microsoft.ServiceBus.Messaging.Sbmp.AcceptMessageSessionAsyncResult..ctor(SbmpMessagingFactory messagingFactory, String entityName, String sessionId, Nullable`1 entityType, ReceiveMode receiveMode, Int32 prefetchCount, Lazy`1 controlMessageCreator, RetryPolicy retryPolicy, TimeSpan serverWaitTime, TimeSpan timeout, AsyncCallback callback, Object state)
       at Microsoft.ServiceBus.Messaging.Sbmp.SbmpQueueClient.OnBeginAcceptMessageSession(String sessionId, ReceiveMode receiveMode, TimeSpan serverWaitTime, TimeSpan timeout, AsyncCallback callback, Object state)
       at Microsoft.ServiceBus.Messaging.QueueClient.RetryAcceptMessageSessionAsyncResult.<GetAsyncSteps>b__68(RetryAcceptMessageSessionAsyncResult thisPtr, TimeSpan t, AsyncCallback c, Object s)
       at Microsoft.ServiceBus.Messaging.IteratorAsyncResult`1.EnumerateSteps(CurrentThreadType state)
    Exception rethrown at [2]:
       at Microsoft.ServiceBus.Common.ExceptionDispatcher.Throw(Exception exception)
       at Microsoft.ServiceBus.Common.AsyncResult.End[TAsyncResult](IAsyncResult result)
       at Microsoft.ServiceBus.Common.AsyncResult`1.End(IAsyncResult asyncResult)
       at Microsoft.ServiceBus.Messaging.QueueClient.RetryAcceptMessageSessionAsyncResult.End(IAsyncResult r)
       at Microsoft.ServiceBus.Messaging.QueueClient.EndAcceptMessageSession(IAsyncResult result)
       at Microsoft.ServiceBus.Messaging.QueueClient.AcceptMessageSession(String sessionId)
       at MDMClasses.Connections.RetrieveMessageResponse..ctor(String sessionId, QueueClient responseQueue)
       at MDMClasses.APIs.MDMSession..ctor()
       at RegistrationPage.registerButton_Click(Object sender, EventArgs e) in c:\Projects\Demo\Higher Education\ASP\Registration ASPX\Registration ASPX\RegistrationPage.aspx.cs:line 24
       at System.Web.UI.WebControls.Button.OnClick(EventArgs e)
       at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)
       at System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
       at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
       at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
       at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
  InnerException: System.IdentityModel.Tokens.SecurityTokenException
       HResult=-2146233087
       Message=The token provider was unable to provide a security token while accessing 'https://mymdmconnector3-sb.accesscontrol.windows.net/WRAPv0.9/'. Token provider returned message: 'The request was aborted: The request was canceled.'.
       InnerException: System.Net.WebException
            HResult=-2146233079
            Message=The request was aborted: The request was canceled.
            Source=System
            StackTrace:
                 at System.Net.HttpWebRequest.EndGetRequestStream(IAsyncResult asyncResult, TransportContext& context)
                 at System.Net.HttpWebRequest.EndGetRequestStream(IAsyncResult asyncResult)
                 at Microsoft.ServiceBus.TokenProviderHelper.TokenRequestAsyncResult.<GetAsyncSteps>b__4(TokenRequestAsyncResult thisPtr, IAsyncResult r)
                 at Microsoft.ServiceBus.Messaging.IteratorAsyncResult`1.StepCallback(IAsyncResult result)
            InnerException: 

The queues connect to Microsoft Dynamics Marketing and are set up like this:

internal static QueueClient Create(string queueName, string serviceBusNamespace, string serviceBusIssuerName, string serviceBusIssuerKey)
        {
            ServiceBusEnvironment.SystemConnectivity.Mode = ConnectivityMode.Http;

            Uri runtimeUri = ServiceBusEnvironment.CreateServiceUri("sb", serviceBusNamespace, string.Empty);
            MessagingFactory messagingFactory = MessagingFactory.Create(runtimeUri, TokenProvider.CreateSharedSecretTokenProvider(serviceBusIssuerName, serviceBusIssuerKey));
            QueueClient queueClient = messagingFactory.CreateQueueClient(queueName);

            return queueClient;
        }

Any suggestions would be greatly appreciated.



Viewing all articles
Browse latest Browse all 1916

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>