meancrazy / LINQPadOData4

OData v4 LINQPad dynamic driver
MIT License
24 stars 15 forks source link

OData 4 and SSL Connection #26

Open bricox opened 3 years ago

bricox commented 3 years ago

When using this extension I receive an error "The SSL connection could not be established, see inner exception". We recently moved from Odata v3 to Odata v4. It worked fine with Odata v3. I can access the service in other tools like Postman without issue. Here is the exception from the LinqPad log.

6.13.13 (X64) 2021-04-27T09:29:22.3089468-04:00 Error opening DataContext RemoteException - WebException - The SSL connection could not be established, see inner exception. Source=OData4.LINQPadDriver

-OData4.LINQPadDriver.Templates.ODataT4CodeGenerator+CodeGenerationContext System.IO.Stream GetEdmxStreamFromUri(System.Uri, OData4.LINQPadDriver.ConnectionProperties) offset: 0x11C -OData4.LINQPadDriver.Templates.ODataT4CodeGenerator+CodeGenerationContext System.String GetEdmxStringFromMetadataPath(System.Uri, OData4.LINQPadDriver.ConnectionProperties) offset: 0x2 -OData4.LINQPadDriver.Templates.ODataT4CodeGenerator System.String TransformText() offset: 0x63 -OData4.LINQPadDriver.DynamicDriver System.Collections.Generic.List`1[LINQPad.Extensibility.DataContext.ExplorerItem] GetSchemaAndBuildAssembly(LINQPad.Extensibility.DataContext.IConnectionInfo, System.Reflection.AssemblyName, System.String ByRef, System.String ByRef) offset: 0x43 -LINQPad.Extensibility.DataContext.DynamicDataContextDriver LINQPad.Extensibility.DataContext.DynamicSchemaResult GetSchemaAndBuildAssemblyInternal(System.String, System.String) offset: 0x28

INNER: HttpRequestException - The SSL connection could not be established, see inner exception. Source=System.Net.Http

-System.Net.Http.ConnectHelper+<EstablishSslConnectionAsyncCore>d__4 Void MoveNext() offset: 0x138
-System.Runtime.ExceptionServices.ExceptionDispatchInfo Void Throw() offset: 0x11
-System.Runtime.CompilerServices.TaskAwaiter Void ThrowForNonSuccess(System.Threading.Tasks.Task) offset: 0x26
-System.Runtime.CompilerServices.TaskAwaiter Void HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task) offset: 0x28
-System.Threading.Tasks.ValueTask`1 TResult get_Result() offset: 0x1B
-System.Runtime.CompilerServices.ConfiguredValueTaskAwaitable`1+ConfiguredValueTaskAwaiter TResult GetResult() offset: 0x0
-System.Net.Http.HttpConnectionPool+<ConnectAsync>d__82 Void MoveNext() offset: 0x344
-System.Runtime.ExceptionServices.ExceptionDispatchInfo Void Throw() offset: 0x11
-System.Runtime.CompilerServices.TaskAwaiter Void ThrowForNonSuccess(System.Threading.Tasks.Task) offset: 0x26
-System.Runtime.CompilerServices.TaskAwaiter Void HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task) offset: 0x28
-System.Runtime.CompilerServices.TaskAwaiter Void ValidateEnd(System.Threading.Tasks.Task) offset: 0x8
-System.Threading.Tasks.ValueTask`1 TResult get_Result() offset: 0x1B
-System.Runtime.CompilerServices.ConfiguredValueTaskAwaitable`1+ConfiguredValueTaskAwaiter TResult GetResult() offset: 0x0
-System.Net.Http.HttpConnectionPool+<CreateHttp11ConnectionAsync>d__86 Void MoveNext() offset: 0x8F
-System.Runtime.ExceptionServices.ExceptionDispatchInfo Void Throw() offset: 0x11
-System.Runtime.CompilerServices.TaskAwaiter Void ThrowForNonSuccess(System.Threading.Tasks.Task) offset: 0x26
-System.Runtime.CompilerServices.TaskAwaiter Void HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task) offset: 0x28
-System.Runtime.CompilerServices.TaskAwaiter Void ValidateEnd(System.Threading.Tasks.Task) offset: 0x8
-System.Threading.Tasks.ValueTask`1 TResult get_Result() offset: 0x1B
-System.Runtime.CompilerServices.ConfiguredValueTaskAwaitable`1+ConfiguredValueTaskAwaiter TResult GetResult() offset: 0x0
-System.Net.Http.HttpConnectionPool+<GetHttpConnectionAsync>d__67 Void MoveNext() offset: 0x13E
-System.Runtime.ExceptionServices.ExceptionDispatchInfo Void Throw() offset: 0x11
-System.Runtime.CompilerServices.TaskAwaiter Void ThrowForNonSuccess(System.Threading.Tasks.Task) offset: 0x26
-System.Runtime.CompilerServices.TaskAwaiter Void HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task) offset: 0x28
-System.Runtime.CompilerServices.TaskAwaiter Void ValidateEnd(System.Threading.Tasks.Task) offset: 0x8
-System.Threading.Tasks.ValueTask`1 TResult get_Result() offset: 0x1B
-System.Runtime.CompilerServices.ConfiguredValueTaskAwaitable`1+ConfiguredValueTaskAwaiter TResult GetResult() offset: 0x0
-System.Net.Http.HttpConnectionPool+<SendWithRetryAsync>d__72 Void MoveNext() offset: 0x91
-System.Runtime.ExceptionServices.ExceptionDispatchInfo Void Throw() offset: 0x11
-System.Runtime.CompilerServices.TaskAwaiter Void ThrowForNonSuccess(System.Threading.Tasks.Task) offset: 0x26
-System.Runtime.CompilerServices.TaskAwaiter Void HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task) offset: 0x28
-System.Threading.Tasks.ValueTask`1 TResult get_Result() offset: 0x1B
-System.Runtime.CompilerServices.ConfiguredValueTaskAwaitable`1+ConfiguredValueTaskAwaiter TResult GetResult() offset: 0x0
-System.Net.Http.RedirectHandler+<SendAsync>d__4 Void MoveNext() offset: 0x94
-System.Runtime.ExceptionServices.ExceptionDispatchInfo Void Throw() offset: 0x11
-System.Runtime.CompilerServices.TaskAwaiter Void ThrowForNonSuccess(System.Threading.Tasks.Task) offset: 0x26
-System.Runtime.CompilerServices.TaskAwaiter Void HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task) offset: 0x28
-System.Threading.Tasks.ValueTask`1 TResult get_Result() offset: 0x1B
-System.Runtime.CompilerServices.ValueTaskAwaiter`1 TResult GetResult() offset: 0x0
-System.Net.Http.HttpMessageHandlerStage System.Net.Http.HttpResponseMessage Send(System.Net.Http.HttpRequestMessage, System.Threading.CancellationToken) offset: 0x12
-System.Net.Http.SocketsHttpHandler System.Net.Http.HttpResponseMessage Send(System.Net.Http.HttpRequestMessage, System.Threading.CancellationToken) offset: 0x84
-System.Net.Http.HttpClientHandler System.Net.Http.HttpResponseMessage Send(System.Net.Http.HttpRequestMessage, System.Threading.CancellationToken) offset: 0xF
-System.Net.Http.HttpMessageInvoker System.Net.Http.HttpResponseMessage Send(System.Net.Http.HttpRequestMessage, System.Threading.CancellationToken) offset: 0x6B
-System.Net.Http.HttpClient+<SendAsyncCore>d__85 Void MoveNext() offset: 0x14B
-System.Runtime.ExceptionServices.ExceptionDispatchInfo Void Throw() offset: 0x11
-System.Runtime.CompilerServices.TaskAwaiter Void ThrowForNonSuccess(System.Threading.Tasks.Task) offset: 0x26
-System.Runtime.CompilerServices.TaskAwaiter Void HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task) offset: 0x28
-System.Threading.Tasks.ValueTask`1 TResult get_Result() offset: 0x1B
-System.Runtime.CompilerServices.ValueTaskAwaiter`1 TResult GetResult() offset: 0x0
-System.Net.Http.HttpClient System.Net.Http.HttpResponseMessage Send(System.Net.Http.HttpRequestMessage, System.Net.Http.HttpCompletionOption, System.Threading.CancellationToken) offset: 0x1B
-System.Net.HttpWebRequest+<SendRequest>d__196 Void MoveNext() offset: 0x1A8
-System.Runtime.ExceptionServices.ExceptionDispatchInfo Void Throw() offset: 0x11
-System.Runtime.CompilerServices.TaskAwaiter Void ThrowForNonSuccess(System.Threading.Tasks.Task) offset: 0x26
-System.Runtime.CompilerServices.TaskAwaiter Void HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task) offset: 0x28
-System.Runtime.CompilerServices.TaskAwaiter`1 TResult GetResult() offset: 0x0
-System.Net.HttpWebRequest System.Net.WebResponse GetResponse() offset: 0x18

  INNER: AuthenticationException - The remote certificate was rejected by the provided RemoteCertificateValidationCallback.
  Source=System.Private.CoreLib

   -System.Runtime.ExceptionServices.ExceptionDispatchInfo Void Throw() offset: 0x11
   -System.Net.Security.SslStream Void SendAuthResetSignal(System.Net.Security.ProtocolToken, System.Runtime.ExceptionServices.ExceptionDispatchInfo) offset: 0x35
   -System.Net.Security.SslStream+<ForceAuthenticationAsync>d__171`1 Void MoveNext() offset: 0x5A3
   -System.Runtime.ExceptionServices.ExceptionDispatchInfo Void Throw() offset: 0x11
   -System.Runtime.CompilerServices.TaskAwaiter Void ThrowForNonSuccess(System.Threading.Tasks.Task) offset: 0x26
   -System.Runtime.CompilerServices.TaskAwaiter Void HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task) offset: 0x28
   -System.Runtime.CompilerServices.TaskAwaiter Void GetResult() offset: 0x0
   -System.Net.Security.SslStream System.Threading.Tasks.Task ProcessAuthentication(Boolean, Boolean, System.Threading.CancellationToken) offset: 0x63
   -System.Net.Security.SslStream Void AuthenticateAsClient(System.Net.Security.SslClientAuthenticationOptions) offset: 0x39
   -System.Net.Http.ConnectHelper+<EstablishSslConnectionAsyncCore>d__4 Void MoveNext() offset: 0xD0

Source=System.Private.CoreLib

-System.Runtime.ExceptionServices.ExceptionDispatchInfo Void Throw() offset: 0x11 -System.Runtime.CompilerServices.TaskAwaiter Void ThrowForNonSuccess(System.Threading.Tasks.Task) offset: 0x27 -System.Runtime.CompilerServices.TaskAwaiter Void HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task) offset: 0x28 -System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1+ConfiguredTaskAwaiter TResult GetResult() offset: 0xB -LINQPad.DataContextManager+d__31 Void MoveNext() offset: 0x58D

First Chance Data: -System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() offset=0x11

GKilsgaard commented 3 years ago

I am getting the same issue when trying to connect to an Odata v4 API from LinqPad 6