划重点:
1、命名空间和包名要指定,最好不要相同,避免冲突
2、编写好 .proto 文件后,一定要 右键项目->编辑项目文件,增加ItemGroup,这里很重要,不然后面增加服务class时会提示找不到服务接口
1 2 3 4 5 | <ItemGroup> <Protobuf Include= "Protos\student.proto" GrpcServices= "Server" /> <Protobuf Include= "Protos\greet.proto" GrpcServices= "Server" /> <Protobuf Include= "Protos\Teachers.proto" GrpcServices= "Server" /> </ItemGroup> |
其他就看下方大神的帖子啦
官方学习链接
创建 gRPC 服务和方法 | Microsoft Docs
防止迷路附上学习链接:
1、https://www.cnblogs.com/helloworld-wang/p/15035652.html
2、Protobuf语法指南(proto3)_freshman94的博客-CSDN博客_proto
3、Protobuf通信协议详解:代码演示、详细原理介绍等 - 知乎