question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot create new gRPC project on macOS

See original GitHub issue

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; });
  });

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:7
  • Comments:15 (9 by maintainers)

github_iconTop GitHub Comments

github_iconTop Results From Across the Web

Troubleshoot gRPC on .NET
Insecure gRPC services must be hosted on a HTTP/2-only port. For more information, see ASP.NET Core protocol negotiation. Unable to start ASP.
Read more >
Tutorial: Create a gRPC client and server in ASP.NET Core
Start Visual Studio for Mac and select File > New Project. In the Choose a template for your new project dialog, select Web...
Read more >
grpc can't make libgpr.a lib on MacOSX
On my OS X version 10.11.5 and the current git clone from github.com/grpc/grpc the make succeeds (but gives some suspicious warnings like ...
Read more >
grpc make can't find protoc 3 (Mac OS Mavericks)
It's just a warning you that it couldn't find the protoc compiler on your system. There might be several reasons for this, the...
Read more >
Visual Studio for Mac can't load gRPC generated code
I used `dotnet new grpc` to create a new ASP.NET gRPC project, and when I open it using VS for Mac, the code...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found