3

I am currently designing a Microservice Architecture, I am very new to the topic, and this question doesn't seem to be explicitly answered anywhere.

Is it possible to Communicate between Microservices (Azure App Services) with gRPC? Could it perhaps be done with Containers or Kestrel in some way so it could support HTTP/2?

I have the following example working when hosted locally: enter image description here

However when hosting them in In Azure it does not seem to work:

Basically Is it even possible to use gRPC in Azure or would I have to use gRPC-Web for all communications? Or are there any Recommendations/Alternatives like REST/SignalR?

Matt
  • 97
  • 9
  • If my solution inspires or helps you, please mark my answer as [accepted](https://meta.stackexchange.com/questions/5234/how-does-accepting-an-answer-work) , Tks~ – Jason Pan Jan 28 '21 at 02:34

5 Answers5

3

gRPC is now supported in Azure Web App service but only for Linux-based Web App.

Here is the official documentation on how to set it up.

Basically, you just need to configure your app to open a port which supports HTTP 2. In .NET Kestrel you do it like this (in example below it's in port 8585):

UPDATE NOVEMBER 2022: Skip this step for .NET 7! Your webapp won't even start with this ConfigureKestrel block of code. Somehow it magically works without it.

// Configure Kestrel to listen on a specific HTTP port 
builder.WebHost.ConfigureKestrel(options => 
{ 
    options.ListenAnyIP(8080); 
    options.ListenAnyIP(8585, listenOptions => 
    { 
        listenOptions.Protocols = Microsoft.AspNetCore.Server.Kestrel.Core.HttpProtocols.Http2; 
    }); 
});

UPDATE NOVEMBER 2022: Following steps are still needed for .NET 7

Then you need to configure HTTP version and proxy in your web app

grpc in azure webapp

Then you need to add an environment variable pointing to the port 8585

grpc setting in azure webapp

I can confirm gRPC already works in West Europe region.

Mirek
  • 4,013
  • 2
  • 32
  • 47
1

According to the developer's usage, I don't recommend using gRPC. For specific details, you can refer to user feedback and some screenshots I took below.

You can read this article first.

SIGNALR VS GRPC ON ASP.NET CORE – WHICH ONE TO CHOOSE

Current status:

  1. gRPC-Web for .NET now available

enter image description here

2. Azure SignalR Service(Official recommendation)

enter image description here

Developer feedback:

gRpc support in Azure App Service

pic 1.

enter image description here

pic 2.

enter image description here

pic 3.

enter image description here

pic 4.

enter image description here

Jason Pan
  • 15,263
  • 1
  • 14
  • 29
  • Looks like the feedback link is dead. This should be the corresponding new one: https://feedback.azure.com/d365community/idea/108a4c91-c825-ec11-b6e6-000d3a4f0f1c – Anttu Feb 22 '22 at 06:44
1

As of now (December 2021), this issue is still open (since April 2019) https://github.com/dotnet/aspnetcore/issues/9020

Azure App Services uses IIS/Windows/Http.sys. Http.sys is baked into the OS and doesn't fully support HTTP/2 trailing headers that gRPC depends on.

Vince
  • 617
  • 8
  • 18
  • Is this also true for app services hosted on linux nodes as that's not limited to any IIS/Http.sys implementations? – Anttu Feb 22 '22 at 06:58
  • 1
    Apparently they are. Have a look at this blog that makes a qualified guess about what the architecture might look like: https://anthonychu.ca/post/jekyll-azure-app-service-linux/. I can confirm this as while trying to setup a gRPC test app on a linux plan I got a 502 error that looked very much like an IIS error page and in the headers I see `server: Microsoft-IIS/10.0` – Anttu Feb 22 '22 at 11:26
1

Figured it out. Ended up using Dapr, a Microservice building package. Its pretty great so far, and it has built in GRPC Support

Matt
  • 97
  • 9
1

Microsoft just announced that it will start supporting gRPC on Azure App Service https://azure.github.io/AppService/2022/05/23/gRPC-support-on-App-Service.html