grpc-dotnet: Cannot create new gRPC project on macOS
I’m unable to run a new gRPC server project on macOS Mojave (10.14.5). I get that ALPN isn’t supported in macOS but is there something that can be added to the template to help with the developer experience in the templates or via documentation?
Steps
dotnet new grpc
dotnet new run
Results
warn: Microsoft.AspNetCore.Server.Kestrel[0]
Unable to bind to https://localhost:5001 on the IPv4 loopback interface: 'HTTP/2 over TLS is not supported on OSX due to missing ALPN support.'.
warn: Microsoft.AspNetCore.Server.Kestrel[0]
Unable to bind to https://localhost:5001 on the IPv6 loopback interface: 'HTTP/2 over TLS is not supported on OSX due to missing ALPN support.'.
crit: Microsoft.AspNetCore.Server.Kestrel[0]
Unable to start Kestrel.
System.IO.IOException: Failed to bind to address https://localhost:5001.
---> System.AggregateException: One or more errors occurred. (HTTP/2 over TLS is not supported on OSX due to missing ALPN support.) (HTTP/2 over TLS is not supported on OSX due to missing ALPN support.)
---> System.NotSupportedException: HTTP/2 over TLS is not supported on OSX due to missing ALPN support.
at Microsoft.AspNetCore.Server.Kestrel.Https.Internal.HttpsConnectionMiddleware..ctor(ConnectionDelegate next, HttpsConnectionAdapterOptions options, ILoggerFactory loggerFactory)
at Microsoft.AspNetCore.Hosting.ListenOptionsHttpsExtensions.<>c__DisplayClass12_0.<UseHttps>b__0(ConnectionDelegate next)
at Microsoft.AspNetCore.Server.Kestrel.Core.ListenOptions.Build()
at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServer.<>c__DisplayClass21_0`1.<<StartAsync>g__OnBind|0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.AddressBinder.BindEndpointAsync(ListenOptions endpoint, AddressBindContext context)
at Microsoft.AspNetCore.Server.Kestrel.Core.LocalhostListenOptions.BindAsync(AddressBindContext context)
--- End of inner exception stack trace ---
---> (Inner Exception #1) System.NotSupportedException: HTTP/2 over TLS is not supported on OSX due to missing ALPN support.
at Microsoft.AspNetCore.Server.Kestrel.Https.Internal.HttpsConnectionMiddleware..ctor(ConnectionDelegate next, HttpsConnectionAdapterOptions options, ILoggerFactory loggerFactory)
at Microsoft.AspNetCore.Hosting.ListenOptionsHttpsExtensions.<>c__DisplayClass12_0.<UseHttps>b__0(ConnectionDelegate next)
at Microsoft.AspNetCore.Server.Kestrel.Core.ListenOptions.Build()
at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServer.<>c__DisplayClass21_0`1.<<StartAsync>g__OnBind|0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.AddressBinder.BindEndpointAsync(ListenOptions endpoint, AddressBindContext context)
at Microsoft.AspNetCore.Server.Kestrel.Core.LocalhostListenOptions.BindAsync(AddressBindContext context)<---
Workaround
webBuilder.UseStartup<Startup>()
.ConfigureKestrel(options =>
{
options.Limits.MinRequestBodyDataRate = null;
options.ListenAnyIP(50050,
listenOptions => { listenOptions.Protocols = HttpProtocols.Http1; });
options.ListenAnyIP(50051,
listenOptions => { listenOptions.Protocols = HttpProtocols.Http2; });
});
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 8
- Comments: 15 (9 by maintainers)
Docs added - https://docs.microsoft.com/aspnet/core/grpc/aspnetcore#grpc-and-aspnet-core-on-macos
I don’t know. Ask at https://github.com/dotnet/runtime/issues/27727
Is there any update on this given the new Mac OS Big Sur update?
I couldn’t find the information needed from this url. This one helped though: https://docs.microsoft.com/aspnet/core/grpc/troubleshoot?view=aspnetcore-3.0&branch=master#unable-to-start-aspnet-core-grpc-app-on-macos.