aboutsummaryrefslogtreecommitdiffhomepage
path: root/doc
diff options
context:
space:
mode:
authorGravatar Jan Tattermusch <jtattermusch@users.noreply.github.com>2018-07-27 11:53:46 +0200
committerGravatar GitHub <noreply@github.com>2018-07-27 11:53:46 +0200
commit8fb45dc24f4c5ab68caa902eeb0cca38ec481395 (patch)
tree6f11003013d9448a7f86ea053cc55c069ae943ab /doc
parent9f89b6f21b864b2305fcbf3dd1a3dd50b79cc825 (diff)
parent871268fce906b61aafa8f9f0bf97a47b03e61854 (diff)
Merge pull request #16136 from jtattermusch/csharp_reflection_docs
Add C# server reflection tutorial
Diffstat (limited to 'doc')
-rw-r--r--doc/csharp/server_reflection.md53
-rw-r--r--doc/server_reflection_tutorial.md2
2 files changed, 54 insertions, 1 deletions
diff --git a/doc/csharp/server_reflection.md b/doc/csharp/server_reflection.md
new file mode 100644
index 0000000000..9721680269
--- /dev/null
+++ b/doc/csharp/server_reflection.md
@@ -0,0 +1,53 @@
+# gRPC C# Server Reflection
+
+This document shows how to use gRPC Server Reflection in gRPC C#.
+Please see [C++ Server Reflection Tutorial](../server_reflection_tutorial.md)
+for general information and more examples how to use server reflection.
+
+## Enable server reflection in C# servers
+
+C# Server Reflection is an add-on library.
+To use it, first install the [Grpc.Reflection](https://www.nuget.org/packages/Grpc.Reflection/)
+Nuget package into your project.
+
+Note that with C# you need to manually register the service
+descriptors with the reflection service implementation when creating a server
+(this isn't necessary with e.g. C++ or Java)
+```csharp
+// the reflection service will be aware of "Greeter" and "ServerReflection" services.
+var reflectionServiceImpl = new ReflectionServiceImpl(Greeter.Descriptor, ServerReflection.Descriptor);
+server = new Server()
+{
+ Services =
+ {
+ // the server will serve 2 services, the Greeter and the ServerReflection
+ ServerReflection.BindService(new GreeterImpl()),
+ ServerReflection.BindService(reflectionServiceImpl)
+ },
+ Ports = { { "localhost", 50051, ServerCredentials.Insecure } }
+};
+server.Start();
+```
+
+After starting the server, you can verify that the server reflection
+is working properly by using the `grpc_cli` command line tool:
+
+ ```sh
+ $ grpc_cli ls localhost:50051
+ ```
+
+ output:
+ ```sh
+ helloworld.Greeter
+ grpc.reflection.v1alpha.ServerReflection
+ ```
+
+ For more examples and instructions how to use the `grpc_cli` tool,
+ please refer to the [`grpc_cli` documentation](../command_line_tool.md)
+ and the [C++ Server Reflection Tutorial](../server_reflection_tutorial.md).
+
+## Additional Resources
+
+The [Server Reflection Protocol](../server-reflection.md) provides detailed
+information about how the server reflection works and describes the server reflection
+protocol in detail.
diff --git a/doc/server_reflection_tutorial.md b/doc/server_reflection_tutorial.md
index ecb176723c..06a257c1e8 100644
--- a/doc/server_reflection_tutorial.md
+++ b/doc/server_reflection_tutorial.md
@@ -10,7 +10,7 @@ RPCs.
### Enable server reflection in C++ servers
-C++ Server Reflection is an add-on library, `libgrpc++_reflction`. To enable C++
+C++ Server Reflection is an add-on library, `libgrpc++_reflection`. To enable C++
server reflection, you can link this library to your server binary.
Some platforms (e.g. Ubuntu 11.10 onwards) only link in libraries that directly