EventStore / EventStore-Client-Dotnet

Dotnet Client SDK for the Event Store gRPC Client API written in C#
Other
147 stars 38 forks source link

System.InvalidOperationException running .net48 #123

Open jenssc opened 3 years ago

jenssc commented 3 years ago

Describe the bug Running the secure-with-tls sample in .net 48 I constantly get this exception:

System.InvalidOperationException
  HResult=0x80131509
  Message=Status(StatusCode="Unavailable", Detail="failed to connect to all addresses", DebugException="Grpc.Core.Internal.CoreErrorDetailException: {"created":"@1622060341.251000000","description":"Failed to pick subchannel","file":"T:\src\github\grpc\workspace_csharp_ext_windows_x86\src\core\ext\filters\client_channel\client_channel.cc","file_line":4166,"referenced_errors":[{"created":"@1622060341.246000000","description":"failed to connect to all addresses","file":"T:\src\github\grpc\workspace_csharp_ext_windows_x86\src\core\ext\filters\client_channel\lb_policy\pick_first\pick_first.cc","file_line":398,"grpc_status":14}]}")
  Source=EventStore.Client
  StackTrace:
   at EventStore.Client.Interceptors.TypedExceptionInterceptor.<AsyncClientStreamingCall>b__5_0[TRequest,TResponse](Task`1 t) in c:\Temp\EventStore-Client-Dotnet\src\EventStore.Client\Interceptors\TypedExceptionInterceptor.cs:line 54
   at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke()
   at System.Threading.Tasks.Task.Execute()

Inner Exception 1:
RpcException: Status(StatusCode="Unavailable", Detail="failed to connect to all addresses", DebugException="Grpc.Core.Internal.CoreErrorDetailException: {"created":"@1622060341.251000000","description":"Failed to pick subchannel","file":"T:\src\github\grpc\workspace_csharp_ext_windows_x86\src\core\ext\filters\client_channel\client_channel.cc","file_line":4166,"referenced_errors":[{"created":"@1622060341.246000000","description":"failed to connect to all addresses","file":"T:\src\github\grpc\workspace_csharp_ext_windows_x86\src\core\ext\filters\client_channel\lb_policy\pick_first\pick_first.cc","file_line":398,"grpc_status":14}]}")

What am I doing wrong?

To Reproduce Steps to reproduce the behavior:

  1. Connectionstring - esdb://admin:changeit@localhost:2113?Tls=true&TlsVerifyCert=false
  2. Run the project

Config/Logs/Screenshots

I0526 22:25:44.373920 0 T:\src\github\grpc\workspace_csharp_ext_windows_x86\src\core\ext\filters\client_channel\subchannel.cc:1073: Connect failed: {"created":"@1622060744.374000000","description":"OS Error","file":"T:\src\github\grpc\workspace_csharp_ext_windows_x86\src\core\lib\iomgr\tcp_client_windows.cc","file_line":106,"os_error":"No connection could be made because the target machine actively refused it.\r\n","syscall":"ConnectEx","wsa_error":10061}
I0526 22:25:44.375881 0 T:\src\github\grpc\workspace_csharp_ext_windows_x86\src\core\ext\filters\client_channel\client_channel.cc:1083: chand=05896B48: connectivity change for subchannel wrapper 00F54B58 subchannel 00F40248; hopping into work_serializer
I0526 22:25:44.375881 0 T:\src\github\grpc\workspace_csharp_ext_windows_x86\src\core\ext\filters\client_channel\client_channel.cc:1116: chand=05896B48: processing connectivity change in work serializer for subchannel wrapper 00F54B58 subchannel 00F40248 watcher=058A0068
I0526 22:25:44.376881 0 T:\src\github\grpc\workspace_csharp_ext_windows_x86\src/core/ext/filters/client_channel/lb_policy/subchannel_list.h:241: [pick_first 05861CC0] subchannel list 00F4EBF8 index 0 of 2 (subchannel 00F54B58): connectivity changed: state=TRANSIENT_FAILURE, shutting_down=0, pending_watcher=058A0068
I0526 22:25:44.376881 0 T:\src\github\grpc\workspace_csharp_ext_windows_x86\src/core/ext/filters/client_channel/lb_policy/subchannel_list.h:328: [pick_first 05861CC0] subchannel list 00F4EBF8 index 0 of 2 (subchannel 00F54B58): canceling connectivity watch (connection attempt failed)
I0526 22:25:44.376881 0 T:\src\github\grpc\workspace_csharp_ext_windows_x86\src/core/ext/filters/client_channel/lb_policy/subchannel_list.h:308: [pick_first 05861CC0] subchannel list 00F4EBF8 index 1 of 2 (subchannel 00F54848): starting watch (from IDLE)

EventStore details

jenssc commented 3 years ago

Actually only working for net5.0! Tried to run the code for all targets (net48, net5.0 and netcoreapp3.1) and only net5.0 is working: secure-with-tls.exe Connecting to EventStoreDB at:esdb://admin:changeit@localhost:2113?Tls=true&TlsVerifyCert=true SUCCESS! Append result: C:12529/P:12529

rmfaheem commented 2 years ago

this can be worked around on .NET 3.1 by initializing the channel credentials on the client settings

var settings = EventStoreClientSettings.Create("esdb://user:password@domain:port");
settings.ChannelCredentials = new SslCredentials();