.net5 grpc 及 grpcui使用
-
创建项目

-
根据vs提供的模板生成给结构如下

至此grpc服务已经准备完成
grpcui
grpcui需要使用到反射,需要手动安装nuget包【Grpc.AspNetCore.Server.Reflection】(不安装这个包会报错Failed to compute set of methods to expose: server does not support the reflection API)
随后在startup文件中的ConfigureServices方法内添加
services.AddGrpcReflection();
在Configure方法的app.UseEndpoints调用中添加
endpoints.MapGrpcReflectionService();
启动服务后即可通过下载的grpcui.exe访问,参数入下
grpcui.exe -plaintext localhost:5000
将会打开网页工具来调试

留待后查,同时方便他人
联系我:renhanlinbsl@163.com
联系我:renhanlinbsl@163.com

浙公网安备 33010602011771号