Hi,
I build an Azure Function App to send something to SB, but I got exception like "The request has timed out after 00:00:00 milliseconds", below are the whole stack tree:
2018-12-03T07:51:15.258 [Info] DEBUG | The request has timed out after 00:00:00 milliseconds. The successful completion of the request cannot be determined. Additional queries should be made to determine whether or not the operation has succeeded. For more information on exception types and proper exception handling, please refer to http://go.microsoft.com/fwlink/?LinkId=761101 System.TimeoutException: The request has timed out after 00:00:00 milliseconds. The successful completion of the request cannot be determined. Additional queries should be made to determine whether or not the operation has succeeded. For more information on exception types and proper exception handling, please refer to http://go.microsoft.com/fwlink/?LinkId=761101 at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at Microsoft.ServiceBus.Common.AsyncResult.End[TAsyncResult](IAsyncResult result) 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.Messaging.IteratorAsyncResult`1.EnumerateSteps(CurrentThreadType state) --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at Microsoft.ServiceBus.Common.AsyncResult.End[TAsyncResult](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.SbmpMessageSender.GetOverheadSize() at Microsoft.ServiceBus.Messaging.Sbmp.SbmpMessageSender..ctor(String path, SbmpMessagingFactory messagingFactory, SbmpMessageCreator messageCreator, RetryPolicy retryPolicy) at Microsoft.ServiceBus.Messaging.Sbmp.CreateSenderLinkSettings..ctor(SbmpMessagingFactory messagingFactory, String entityName, Nullable`1 entityType, String transferDestinationEntityName, RetryPolicy retryPolicy) at Microsoft.ServiceBus.Messaging.Sbmp.SbmpQueueClient.OnBeginCreateSender(TimeSpan timeout, AsyncCallback callback, Object state) at Microsoft.ServiceBus.Messaging.OpenOnceManager.OpenOnceManagerAsyncResult`1.BeginOperation() at Microsoft.ServiceBus.Common.AsyncResult.SyncContinue(IAsyncResult result) at Microsoft.ServiceBus.Messaging.OpenOnceManager.OpenOnceManagerAsyncResult`1..ctor(OpenOnceManager openOnceManager, TimeSpan openTimeout, AsyncCallback callback, Object state, Func`3 beginOperation, EndOperation`1 endOperation) at Microsoft.ServiceBus.Messaging.OpenOnceManager.Begin[T](AsyncCallback callback, Object state, Func`3 beginOperation, Func`2 endOperation) at Microsoft.ServiceBus.Messaging.QueueClient.BeginCreateSender(TimeSpan timeout, AsyncCallback callback, Object state) at Microsoft.ServiceBus.Messaging.QueueClient.EnsureCreateInternalSender() at Microsoft.ServiceBus.Messaging.QueueClient.ThrowIfSenderNull(String operationName) at Microsoft.ServiceBus.Messaging.QueueClient.SendBatch(IEnumerable`1 messages) at Microsoft.Practices.TransientFaultHandling.RetryPolicy.<>c__DisplayClass1.<ExecuteAction>b__0() at Microsoft.Practices.TransientFaultHandling.RetryPolicy.ExecuteAction[TResult](Func`1 func) Microsoft.ServiceBus: Microsoft.ServiceBus
And here is the code to send message:
var tokenProvider = TokenProvider.CreateSharedAccessSignatureTokenProvider("ServiceBusKeyName", "ServiceBusSharedAccessKey"); var uri = new Uri(_endpoint); var queueName = uri.LocalPath.Substring(1); var address = uri.GetLeftPart(UriPartial.Authority); //prepare data var data = ... var factory = MessagingFactory.Create(address, tokenProvider); var queueClient = factory.CreateQueueClient(queueName); datas.ForEach(p => _retryPolicy.ExecuteAction(() => queueClient.SendBatch(p)));I run the code in console app, it works well, but by Azure Function Apps, it always failed. Any suggestions would be greatly appreciated.