Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
36 lines (33 sloc) 1.22 KB
published title date author layout permalink tags
true
HTTP/2 over TLS is not supported on macOS due to missing ALPN support
2019-12-03 08:30:00 UTC
fabiocozzolino
post
/HTTP2-over-TLS-is-not-supported-on-macOS/
gRPC
.NET Core
ASP.NET Core
Tls
Security

If you are working with .NET Core on MacOS, you'll probably get the following exception:

System.NotSupportedException: HTTP/2 over TLS is not supported on macOS due to missing ALPN support.

This happens because at the moment Kestrel doesn't support HTTP/2 with TLS on macOS and older Windows versions such as Windows 7. To work around this issue, you have to disable TLS. Open your Program.cs file and update the CreateHostBuilder with the following lines:

public static IHostBuilder CreateHostBuilder(string[] args) =>
    Host.CreateDefaultBuilder(args)
        .ConfigureWebHostDefaults(webBuilder =>
        {
            webBuilder.ConfigureKestrel(options =>
            {
                options.ListenLocalhost(5000, o => o.Protocols = HttpProtocols.Http2);
            });
            webBuilder.UseStartup<Startup>();
        });

That's it! Now you can execute dotnet run command to start your gRPC service.

Enjoy!

You can’t perform that action at this time.