1

I had created a gRPC service using Servicestack and was able to consume from the console application.

When I a trying to call it from angular 12, i was getting the CORS issue I fixed by adding below code

services.AddCors(o => o.AddPolicy("AllowAll", builder =>
        {
            builder.AllowAnyOrigin()
                   .AllowAnyMethod()
                   .AllowAnyHeader()
                   .WithExposedHeaders("Grpc-Status", "Grpc-Message", "Grpc-Encoding", "Grpc- 
Accept-Encoding", "Grpc-Web-Text");
        }));

Now the CORS issue resolved However I am getting the below issue from angular

Grpc.AspNetCore.Server.ServerCallHandler[2] Request content-type of 'application/grpc-web-text' is not supported.

sajesh
  • 11
  • 2
  • I'd highly recommend calling JSON APIs with [TypeScript Add ServiceStack Reference](https://docs.servicestack.net/typescript-add-servicestack-reference) in Web Apps then trying to use [gRPC Web and its special requirements](https://docs.servicestack.net/grpc#grpc-web). – mythz Jun 05 '21 at 12:33

0 Answers0