Code Monkey home page Code Monkey logo

Comments (4)

nguyenvanbien95 avatar nguyenvanbien95 commented on July 3, 2024

Em cấu hình gateway theo Option 1 thì ko chạy được. Check source thì dòng 31 trong file DownStreamContextExtensions
var methodPath = context.DownstreamReRoute.DownstreamPathTemplate.Value; var grpcAssemblyResolver = context.HttpContext.RequestServices.GetService<GrpcAssemblyResolver>(); var methodDescriptor = grpcAssemblyResolver.FindMethodDescriptor(methodPath.Split('/').Last().ToUpperInvariant());
không lấy được grpcAssemblyResolver.

phải bổ sung theo hướng dẫn (Option 2) thì cần cấu hình thêm ở file StartUp.cs
services.AddGrpcJsonTranscoder(() => new GrpcAssemblyResolver().ConfigGrpcAssembly(typeof(Greeter.GreeterClient).Assembly));
thì mới chạy được.
=> Chỗ này e chưa hiểu là do e cấu hình sai hay hướng dẫn gộp chung phần cấu hình file StartUp.cs.

from grpcjsontranscoder.

thangchung avatar thangchung commented on July 3, 2024

hi Bien, thank you for your information. I will do a double check due to the new .NET Core 3.0 SDK

HTTP/1.1 GET http://localhost:5000/say/Bob Ocelot.Errors.Middleware.ExceptionHandlerMiddleware:Debug: requestId: 0HLPSQDD4RDKQ:00000001, previousRequestId: no previous request id, message: ocelot pipeline started

The HTTP/1.1 should not be happen here, because of HTTP/2 is a default mode for gRPC.

I am working on it at https://github.com/vietnam-devs/coolstore-microservices/tree/develop/src/gateways/webapi-gateway

from grpcjsontranscoder.

nguyenvanbien95 avatar nguyenvanbien95 commented on July 3, 2024

Of course, HTTP/2 is default for gRPC but in this case, I was using Postman for test Api-gateway. So, it is HTTP/1.1.
I am confused when reading the guide at Readme.md. That is config between Option 1 and Option 2.
Can you rewrite for Option 1? I saw that services is imported is very important. So, it should highlight.

from grpcjsontranscoder.

thangchung avatar thangchung commented on July 3, 2024

@nguyenvanbien95 Agree with you about it. By the time, see the Ocelot gateway works with GrpcJsonTranscoder at https://github.com/vietnam-devs/coolstore-microservices/tree/develop/src/gateways/webapi-gateway, and it configures for the downstream services at https://github.com/vietnam-devs/coolstore-microservices/tree/develop/src/microservices

To get starting, run the command below

# at root coolstore-microservices project 
$ # docker-compose -f docker-compose.yml -f docker-compose.dev.yml up -d

Remember to change /c/Users/<your windows user path>/.nuget/packages, if you run it on Windows.

I will fix the readme for this project soon as soon as I finish to test it on coolstore-microservices project. Thank you for your interesting on this project

from grpcjsontranscoder.

Related Issues (8)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.