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

Azure Service Bus Error. Send message to Queue - The X.509 certificate CN=servicebus.windows.net chain building failed

$
0
0

Hi,

I am trying to complete this tutorial:

Service Bus Brokered Messaging .NET Tutorial

This is a simple tutorial, where you:

- manually create a Service Bus Namespace using the Azure portal ,
- programatically create a queue,
- programatically send to the queue,
- programatically read from the queue

I have copied the final code that is run inside my own console application from:
Shows Complete Code to run

And tried to run, The Queue is successfully created on the Azure portal with the below code:

     NamespaceManager namespaceClient = new NamespaceManager(ServiceBusEnvironment.CreateServiceUri("sb", ServiceNamespace, string.Empty), credentials);
     namespaceClient.CreateQueue("IssueTrackingQueue");

 

But when trying to Send to the Queue using this abridged code (complete code can be seen in link above):

 
   QueueClient myQueueClient = factory.CreateQueueClient("IssueTrackingQueue");
            // Send messages
            Console.WriteLine("Now sending messages to the Queue.");
            for (int count = 0; count < 6; count++)
            {
                var issue = MessageList[count];
                issue.Label = issue.Properties["IssueTitle"].ToString();
                myQueueClient.Send(issue);
                Console.WriteLine(string.Format("Message sent: {0}, {1}", issue.Label, issue.MessageId));
            }

The below code throws error:

 myQueueClient.Send(issue);
Error as below:
Message=The X.509 certificate CN=servicebus.windows.net is not in the trusted people store. The X.509 certificate CN=servicebus.windows.net chain building failed. The certificate that was used has a trust chain that cannot be verified. Replace the certificate or change the certificateValidationMode. A certificate chain could not be built to a trusted root authority.

I have seen references to this error using the On-Premise Windows Service Bus, but not with the Azure Service Bus, as this example uses.

I am using the Azure SDK 2.2
It takes approx 10 - 20 seconds before get error, 

The full error is as below:

Microsoft.ServiceBus.Messaging.MessagingCommunicationException was unhandled
  HResult=-2146233088
  Message=The X.509 certificate CN=servicebus.windows.net is not in the trusted people store. The X.509 certificate CN=servicebus.windows.net chain building failed. The certificate that was used has a trust chain that cannot be verified. Replace the certificate or change the certificateValidationMode. A certificate chain could not be built to a trusted root authority.

  Source=Microsoft.ServiceBus
  IsTransient=true
  StackTrace:
       at Microsoft.ServiceBus.Common.ExceptionDispatcher.Throw(Exception exception)
       at Microsoft.ServiceBus.Common.AsyncResult.End[TAsyncResult](IAsyncResult result)
       at Microsoft.ServiceBus.Messaging.IteratorAsyncResult`1.RunSynchronously()
       at Microsoft.ServiceBus.Messaging.MessageSender.OnSend(TrackingContext trackingContext, IEnumerable`1 messages, TimeSpan timeout)
       at Microsoft.ServiceBus.Messaging.MessageSender.Send(TrackingContext trackingContext, IEnumerable`1 messages, TimeSpan timeout)
       at Microsoft.ServiceBus.Messaging.MessageSender.Send(BrokeredMessage message)
       at Microsoft.ServiceBus.Messaging.QueueClient.Send(BrokeredMessage message)
       at Microsoft.ServiceBus.Samples.Program.Queue() in c:\ServiceBroker\Examples\QueueExample\QueueExample\Program.cs:line 128
       at Microsoft.ServiceBus.Samples.Program.Main(String[] args) in c:\ServiceBroker\Examples\QueueExample\QueueExample\Program.cs:line 33
       at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException: System.ServiceModel.Security.SecurityNegotiationException
       HResult=-2146233087
       Message=The X.509 certificate CN=servicebus.windows.net is not in the trusted people store. The X.509 certificate CN=servicebus.windows.net chain building failed. The certificate that was used has a trust chain that cannot be verified. Replace the certificate or change the certificateValidationMode. A certificate chain could not be built to a trusted root authority.

       Source=Microsoft.ServiceBus
       StackTrace:
         Server stack trace: 
            at Microsoft.ServiceBus.Messaging.Channels.SharedChannel`1.CreateChannelAsyncResult.<GetAsyncSteps>d__7.MoveNext()
            at Microsoft.ServiceBus.Messaging.IteratorAsyncResult`1.MoveNextStep()
            at Microsoft.ServiceBus.Messaging.IteratorAsyncResult`1.EnumerateSteps(CurrentThreadType state)
            at Microsoft.ServiceBus.Messaging.IteratorAsyncResult`1.StepCallback(IAsyncResult result)
            at Microsoft.ServiceBus.Common.AsyncResult.AsyncCompletionWrapperCallback(IAsyncResult result)
         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.Messaging.Channels.SharedChannel`1.OnEndCreateInstance(IAsyncResult asyncResult)
            at Microsoft.ServiceBus.Messaging.SingletonManager`1.EndGetInstance(IAsyncResult asyncResult)
            at Microsoft.ServiceBus.Messaging.Channels.ReconnectBindingElement.ReconnectChannelFactory`1.RequestSessionChannel.RequestAsyncResult.<GetAsyncSteps>b__2(RequestAsyncResult 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.Messaging.SingletonManager`1.AsyncWaiter.End(IAsyncResult asyncResult, TSingleton& result)
            at Microsoft.ServiceBus.Messaging.SingletonManager`1.EndGetInstance(IAsyncResult asyncResult)
            at Microsoft.ServiceBus.Messaging.Channels.ReconnectBindingElement.ReconnectChannelFactory`1.RequestSessionChannel.RequestAsyncResult.<GetAsyncSteps>b__2(RequestAsyncResult thisPtr, IAsyncResult r)
            at Microsoft.ServiceBus.Messaging.IteratorAsyncResult`1.StepCallback(IAsyncResult result)
         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.Channels.ReconnectBindingElement.ReconnectChannelFactory`1.RequestSessionChannel.EndRequest(IAsyncResult result)
            at Microsoft.ServiceBus.Messaging.Sbmp.RedirectBindingElement.RedirectContainerChannelFactory`1.RedirectContainerSessionChannel.RequestAsyncResult.<>c__DisplayClass17.<GetAsyncSteps>b__a(RequestAsyncResult thisPtr, IAsyncResult r)
            at Microsoft.ServiceBus.Messaging.IteratorAsyncResult`1.StepCallback(IAsyncResult result)
         Exception rethrown at [3]: 
            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.Sbmp.RedirectBindingElement.RedirectContainerChannelFactory`1.RedirectContainerSessionChannel.EndRequest(IAsyncResult result)
            at Microsoft.ServiceBus.Messaging.Channels.ReconnectBindingElement.ReconnectChannelFactory`1.RequestSessionChannel.RequestAsyncResult.<GetAsyncSteps>b__4(RequestAsyncResult thisPtr, IAsyncResult r)
            at Microsoft.ServiceBus.Messaging.IteratorAsyncResult`1.StepCallback(IAsyncResult result)
         Exception rethrown at [4]: 
            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.Channels.ReconnectBindingElement.ReconnectChannelFactory`1.RequestSessionChannel.EndRequest(IAsyncResult result)
            at Microsoft.ServiceBus.Messaging.Sbmp.SbmpTransactionalAsyncResult`1.<GetAsyncSteps>b__3b(TIteratorAsyncResult thisPtr, IAsyncResult a)
            at Microsoft.ServiceBus.Messaging.IteratorAsyncResult`1.StepCallback(IAsyncResult result)
         Exception rethrown at [5]: 
            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.Sbmp.SbmpMessageSender.EndSendCommand(IAsyncResult result)
       InnerException: System.IdentityModel.Tokens.SecurityTokenValidationException
            HResult=-2146233087
            Message=The X.509 certificate CN=servicebus.windows.net is not in the trusted people store. The X.509 certificate CN=servicebus.windows.net chain building failed. The certificate that was used has a trust chain that cannot be verified. Replace the certificate or change the certificateValidationMode. A certificate chain could not be built to a trusted root authority.

            Source=System
            StackTrace:
                 at System.Net.Security.SslState.EndProcessAuthentication(IAsyncResult result)
                 at System.ServiceModel.Channels.SslStreamSecurityUpgradeInitiator.InitiateUpgradeAsyncResult.OnCompleteAuthenticateAsClient(IAsyncResult result)
            InnerException: 


Viewing all articles
Browse latest Browse all 1916

Trending Articles



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