Reputation: 195
I have GRPC application which I have created and deployed from visual studio to azure app service.
OS # Linux
Azure Service plan is # S1
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 #
we are not able connect GRPC.
Upvotes: 1
Views: 662
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.
I enabled TLS by clicking the lock symbol in Postman, as shown below.
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.
Ensure that your values are as follows:
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.
Output:
Upvotes: 1