Debugging Blazor Webassembly with gRPC Server as Hosting

Debugging Blazor Webassembly with gRPC Server as Hosting

I have a Blazor WASM Application that shall be hosted inside the Backend that is implemented using gRPC on ASP.NET with .NET 5.0. When I try to debug the WASM application and as soon as the debugging Browser starts I get this error:

fail: Microsoft.AspNetCore.Server.Kestrel[0]
  HTTP/2 over TLS was not negotiated on an HTTP/2-only endpoint.

All development certificates are installed and trusted and the websocket connection is established using wss:// scheme. So from my point of view the TLS negotiation should succeed.

I already found out that I can workaround that to a certain point by changing the Kestrel endpoint settings to use Http1AndHttp2 the problem then becomes that the gRPC connection from the frontend to the backend fails because of the downgrade to Http/1.

So my question is: Is there any option to debug Blazot WASM when using an Http/2 server on the hosting site? If this is not possible: Can I determine somehow that the gRPC endpoints get delivered using HTTP/2 and the debugging endpoints via HTTP/1.1?

1

2 Answers

Here are some tips for checking TLS negotiation limitation on Http/2:

  1. TLS version 1.2 or later
  2. Renegotiation disabled
  3. Compression disabled
  4. Minimum ephemeral key exchange sizes:
    • Elliptic curve Diffie-Hellman (ECDHE) [RFC4492]: 224 bits minimum
    • Finite field Diffie-Hellman (DHE) [TLS12]: 2048 bits minimum
  5. Cipher suite not prohibited.

So the solution is quitq simple: I used the wrong package. When using Blazor with gRPC the Grpc.Client.Net.Web package must be used (as stated in this article: ).

Then you do not have to use HTTP/2 and everything works like a charm.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Robert Thorne
Author

Robert Thorne

Robert Thorne covers electric vehicle innovations, autonomous driving systems, global mobility trends, and automotive engineering developments.