Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get error: The remote certificate is invalid according to the validation procedure. #8

Open
eureka-gh opened this issue Nov 13, 2021 · 0 comments

Comments

@eureka-gh
Copy link

I am using DefaultAzureCredential() to create client and set the role correctly for 'Azure Service Bus Data Reader' and 'Azure Service Bus Data Sender' not 'Contributor'

client = new ServiceBusClient($"{Config.Namespace}.servicebus.windows.net.", new DefaultAzureCredential());
// skip the receiver part
ServiceBusSender sender = client.CreateSender(Config.Queue);
ServiceBusMessage message = new ServiceBusMessage(">>> hello !!!");
await sender.SendMessageAsync(message);

but always get this error:

An unhandled exception occurred while processing the request.
AuthenticationException: The remote certificate is invalid according to the validation procedure.
System.Net.Security.SslStream.StartSendAuthResetSignal(ProtocolToken message, AsyncProtocolRequest asyncRequest, ExceptionDispatchInfo exception)

Stack Query Cookies Headers Routing
AuthenticationException: The remote certificate is invalid according to the validation procedure.
System.Net.Security.SslStream.StartSendAuthResetSignal(ProtocolToken message, AsyncProtocolRequest asyncRequest, ExceptionDispatchInfo exception)
System.Net.Security.SslStream.CheckCompletionBeforeNextReceive(ProtocolToken message, AsyncProtocolRequest asyncRequest)
System.Net.Security.SslStream.StartSendBlob(byte[] incoming, int count, AsyncProtocolRequest asyncRequest)
System.Net.Security.SslStream.ProcessReceivedBlob(byte[] buffer, int count, AsyncProtocolRequest asyncRequest)
System.Net.Security.SslStream.StartReadFrame(byte[] buffer, int readBytes, AsyncProtocolRequest asyncRequest)
System.Net.Security.SslStream.StartReceiveBlob(byte[] buffer, AsyncProtocolRequest asyncRequest)
System.Net.Security.SslStream.CheckCompletionBeforeNextReceive(ProtocolToken message, AsyncProtocolRequest asyncRequest)
System.Net.Security.SslStream.StartSendBlob(byte[] incoming, int count, AsyncProtocolRequest asyncRequest)
System.Net.Security.SslStream.ProcessReceivedBlob(byte[] buffer, int count, AsyncProtocolRequest asyncRequest)
System.Net.Security.SslStream.StartReadFrame(byte[] buffer, int readBytes, AsyncProtocolRequest asyncRequest)
System.Net.Security.SslStream.PartialFrameCallback(AsyncProtocolRequest asyncRequest)
System.Net.Security.SslStream.ThrowIfExceptional()
System.Net.Security.SslStream.InternalEndProcessAuthentication(LazyAsyncResult lazyResult)
System.Net.Security.SslStream.EndProcessAuthentication(IAsyncResult result)
System.Net.Security.SslStream.EndAuthenticateAsClient(IAsyncResult asyncResult)
Microsoft.Azure.Amqp.Transport.TlsTransport.HandleOpenComplete(IAsyncResult result, bool syncComplete)
Microsoft.Azure.Amqp.ExceptionDispatcher.Throw(Exception exception)
Microsoft.Azure.Amqp.AsyncResult.End(IAsyncResult result)
Microsoft.Azure.Amqp.AmqpObject+OpenAsyncResult.End(IAsyncResult result)
Microsoft.Azure.Amqp.AmqpObject.EndOpen(IAsyncResult result)
Microsoft.Azure.Amqp.Transport.TlsTransportInitiator.HandleTransportOpened(IAsyncResult result)
Microsoft.Azure.Amqp.Transport.TlsTransportInitiator.OnTransportOpened(IAsyncResult result)
Azure.Messaging.ServiceBus.Amqp.AmqpConnectionScope.CreateAndOpenConnectionAsync(Version amqpVersion, Uri serviceEndpoint, ServiceBusTransportType transportType, IWebProxy proxy, string scopeIdentifier, TimeSpan timeout)
Microsoft.Azure.Amqp.FaultTolerantAmqpObject.OnCreateAsync(TimeSpan timeout)
Microsoft.Azure.Amqp.Singleton.GetOrCreateAsync(TimeSpan timeout)
Microsoft.Azure.Amqp.Singleton.GetOrCreateAsync(TimeSpan timeout)
Azure.Messaging.ServiceBus.Amqp.AmqpConnectionScope.OpenSenderLinkAsync(string entityPath, string identifier, TimeSpan timeout, CancellationToken cancellationToken)
Azure.Messaging.ServiceBus.Amqp.AmqpSender.CreateLinkAndEnsureSenderStateAsync(TimeSpan timeout, CancellationToken cancellationToken)
Microsoft.Azure.Amqp.FaultTolerantAmqpObject.OnCreateAsync(TimeSpan timeout)
Microsoft.Azure.Amqp.Singleton.GetOrCreateAsync(TimeSpan timeout)
Microsoft.Azure.Amqp.Singleton.GetOrCreateAsync(TimeSpan timeout)
Azure.Messaging.ServiceBus.Amqp.AmqpSender.SendBatchInternalAsync(Func messageFactory, TimeSpan timeout, CancellationToken cancellationToken)
Azure.Messaging.ServiceBus.Amqp.AmqpSender.SendBatchInternalAsync(Func messageFactory, TimeSpan timeout, CancellationToken cancellationToken)
Azure.Messaging.ServiceBus.Amqp.AmqpSender+<>c__DisplayClass20_0+<b__1>d.MoveNext()
Azure.Messaging.ServiceBus.ServiceBusRetryPolicy.RunOperation(Func<TimeSpan, Task> operation, TransportConnectionScope scope, CancellationToken cancellationToken)
Azure.Messaging.ServiceBus.ServiceBusRetryPolicy.RunOperation(Func<TimeSpan, Task> operation, TransportConnectionScope scope, CancellationToken cancellationToken)
Azure.Messaging.ServiceBus.Amqp.AmqpSender.SendAsync(IReadOnlyList messages, CancellationToken cancellationToken)
Azure.Messaging.ServiceBus.ServiceBusSender.SendMessagesAsync(IEnumerable messages, CancellationToken cancellationToken)
Azure.Messaging.ServiceBus.ServiceBusSender.SendMessageAsync(ServiceBusMessage message, CancellationToken cancellationToken)
WebAppServiceBus.Controllers.HomeController.Send(ServiceBusMessageData messageInfo) in HomeController.cs
+
await sender.SendMessageAsync(message);
lambda_method(Closure , object )
Microsoft.Extensions.Internal.ObjectMethodExecutorAwaitable+Awaiter.GetResult()
Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor+TaskOfActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, object controller, object[] arguments)
System.Threading.Tasks.ValueTask.get_Result()
System.Runtime.CompilerServices.ValueTaskAwaiter.GetResult()
Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.g__Logged|12_1(ControllerActionInvoker invoker)
Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, object state, bool isCompleted)
Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(ref State next, ref Scope scope, ref object state, ref bool isCompleted)
Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.g__Awaited|13_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, object state, bool isCompleted)
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|24_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, object state, bool isCompleted)
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(ref State next, ref Scope scope, ref object state, ref bool isCompleted)
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|19_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, object state, bool isCompleted)
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Logged|17_1(ResourceInvoker invoker)
Microsoft.AspNetCore.Builder.RouterMiddleware.Invoke(HttpContext httpContext)
Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)

Does anyone has any idea on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant