我按照以下说明创建了一个 grpc 服务器和客户端:https://learn.microsoft.com/en-us/aspnet/core/tutorials/grpc/grpc-start ?view=aspnetcore-3.0&tabs=visual-studio 。
当我尝试从客户端调用服务时,客户端显示此错误消息:“发生一个或多个错误。(Status(StatusCode=Unknown, Detail="No status received"))"
和服务器这个:
info: Microsoft.AspNetCore.Hosting.Diagnostics[1]
Request starting HTTP/2 POST http://STEINI-PC/LocationService/GetLocations application/grpc
info: Microsoft.AspNetCore.Routing.EndpointMiddleware[0]
Executing endpoint 'gRPC - gRPC - Unimplemented service'
info: Grpc.AspNetCore.Server.Internal.ServerCallHandlerFactory[1]
Service 'LocationService' is unimplemented.
info: Microsoft.AspNetCore.Routing.EndpointMiddleware[1]
Executed endpoint 'gRPC - gRPC - Unimplemented service'
info: Microsoft.AspNetCore.Hosting.Diagnostics[2]
Request finished in 51.812000000000005ms 200 application/grpc
原型文件:
syntax = "proto3";
service EventService {
rpc GetEvents (Empty) returns (Events) {}
rpc GetEvent (Id) returns (Event) {}
rpc GetEventsByLocation (Id) returns (Events) {}
rpc AddEvent (Event) returns (Empty) {}
rpc UpdateEvent (Event) returns (Empty) {}
rpc DeleteEvent (Id) returns (Event) {}
}
service LocationService {
rpc GetLocations (Empty) returns (Locations) {}
rpc GetLocation (Id) returns (Location) {}
rpc AddLocation (Location) returns (Empty) {}
rpc UpdateLocation (Location) returns (Empty) {}
rpc DeleteLocation (Id) returns (Location) {}
}
service ParticipantService {
rpc GetParticipants (Empty) returns (Participants) {}
rpc GetParticipant (Id) returns (Participant) {}
rpc GetParticipantsFromEvent (Id) returns (Participants) {}
rpc AddParticipant (Participant) returns (Empty) {}
rpc UpdateParticipant (Participant) returns (Empty) {}
rpc DeleteParticipant (Id) returns (Participant) {}
}
message Empty {
}
message Id {
string id = 1;
}
暮色呼如
明月笑刀无情
森林海
aluckdog
相关分类