Maulik Dave
Maulik Dave

Reputation: 195

GRPC connectivity issue with Azure App Service from local post man?

I have GRPC application which I have created and deployed from visual studio to azure app service. OS # Linux Azure Service plan is # S1 enter image description here

Network Configuration # enter image description here

On the App settings tab, add the following app settings to your application: Name = HTTP20_ONLY_PORT Value = 8585

when we try to run from post mane with azure app service URL #

enter image description here

we are not able connect GRPC.

Upvotes: 1

Views: 662

Answers (1)

Aslesha Kantamsetti
Aslesha Kantamsetti

Reputation: 1491

I followed this document to create this project.

After creating the gRPC web app, it was deployed to Azure App Service. I am able to see the output in Postman.

Program.cs:

using GrpcService2.Services;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddGrpc();
var app = builder.Build();
app.MapGrpcService<GreeterService>();
app.MapGet("/", () => "To communicate with gRPC, use the client.");
app.Run();

GreeterService.cs:

using Grpc.Core;
using GrpcService2;
namespace GrpcService2.Services
{
    public class GreeterService : Greeter.GreeterBase
    {
        private readonly ILogger<GreeterService> _logger;
        public GreeterService(ILogger<GreeterService> logger)
        {
            _logger = logger;
        }
        public override Task<HelloReply> SayHello(HelloRequest request, ServerCallContext context)
        {
            return Task.FromResult(new HelloReply
            {
                Message = "Hello " + request.Name
            });
        }
    }
}

greet.proto:

syntax = "proto3";
option csharp_namespace = "GrpcService2";
package greet;
service Greeter {
  rpc SayHello (HelloRequest) returns (HelloReply);
}
message HelloRequest {
  string name = 1;
}
message HelloReply {
  string message = 1;
}

After running the gRPC app, I copied the following HTTPS URL, as it is a secure connection.

enter image description here

I enabled TLS by clicking the lock symbol in Postman, as shown below.

enter image description here

In the Azure Web App, under Environment Variables and App Settings, I set the following value:

Name=HTTP20_ONLY_PORT Value=5243

As shown below.

enter image description here

Ensure that your values are as follows:

enter image description here

I successfully deployed the app to Azure through Visual Studio.

The Azure Web App URL is a secure connection, so you need to enable TLS as shown below.

enter image description here

Output:

enter image description here

Upvotes: 1

Related Questions