Williwyg
Williwyg

Reputation: 681

How to Add service reference of type "gRPC" to a project in Visual Studio

I have two projects in a Visual Studio Solution.

I want to reference project 1 as a "Connected service" from project 2. So when a DataContract of the gRpc service changes I will be able to update the "service reference" and the client stubs that communicate with the gRpc server will be regenerated.

I try to configure the client project and add a "Connected service". In the "Add service reference" dialog I choose to add a service of type "gRPC". After clicking the "Next" button I provide the url to the reflection endpoint of my running grpc server. (https://localhost:portnumber/grpc.reflection.v1alpha.ServerReflection/ServerReflectionInfo)

After clicking the finish button I receive an error message "Failed to download metadata file from : https://localhost:portnumber/grpc.reflection.v1alpha.ServerReflection/ServerReflectionInfo" In the logging info on my grpc server I see and error message "Request content-type of '(null)' is not supported".

What does Visual Studio expect as input to configure a gRpc connected service?

Note: I have tested my gRpc server with Postman and dotnet-grpc-cli. Endpoints and contracts are correctly discovered and can be invoked using the Postman UI.

Upvotes: 1

Views: 552

Answers (1)

Williwyg
Williwyg

Reputation: 681

I found the solution myself. The Url that is used in the "Add gRPC connected service" dialog needs to point to a http GET endpoint that returns a .proto file. Not as I expected a url to a grpc reflection endpoint.

Thanks Microsoft for the missing documentation....

Upvotes: 0

Related Questions