Hi all,
I am currently migrating from TCP to gRPC and got stuck with this error using SubscribeToAll()
An HTTP/2 connection could not be established because the server did not complete the HTTP/2 handshake. (InvalidResponse) System.Exception {System.Net.Http.HttpRequestException}
with this inner exception
Evaluation of method System.Exception.get_Message requires calling method System.RuntimeType.GetEnumUnderlyingType, which cannot be called in this context.
The code is basically the same to the one used in the official documentation. The only difference that I can think could be a possible cause, is that it is running in a class implementing IHostedService (executed as a singleton)
var subscription = eventStoreClient.SubscribeToAll(FromAll.After(from), cancellationToken: cancellationToken);
await foreach (var message in subscription.Messages)
{
if (stop)
break;
if (message is StreamMessage.Event(var evnt))
{
log.LogDebug($"Received event {evnt.OriginalEventNumber}@{evnt.OriginalStreamId}");
liveQueue.Enqueue(evnt);
EnsurePublishEvents(liveQueue, liveDone);
}
}
Also, if I try something like this
var subscription = eventStoreClient.SubscribeToAll(FromAll.Start, cancellationToken: cancellationToken); var count = await subscription.Messages.CountAsync(); //also with .FirstAsync() and .ForEachAsync()
I get the following error
Messages may only be enumerated once.
Clearly I am doing something wrong, can someone point me in the right direction?
I’m currently using the ES’s docker image “23.10.1-jammy” and EventStore.Client.Grpc.Streams 23.2.1