https://github.com/p7coreorg/grpc-dotnetcore-play
https://github.com/p7coreorg/grpc-dotnetcore-play
Last synced: 8 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/p7coreorg/grpc-dotnetcore-play
- Owner: P7CoreOrg
- License: mit
- Created: 2019-09-10T23:45:52.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2022-02-11T02:39:40.000Z (about 4 years ago)
- Last Synced: 2025-06-13T19:09:54.607Z (10 months ago)
- Language: C#
- Size: 61.5 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# gRPC-dotnetcore-play
## Currently using v3.0.0-preview9 sdk
[.NET Core 3.0 SDKs](https://dotnet.microsoft.com/download/dotnet-core/3.0)
[SDK 3.0.100-preview9-014004](https://dotnet.microsoft.com/download/thank-you/dotnet-sdk-3.0.100-preview9-windows-x64-installer)
```
ps> ./build.ps1
ps> docker-compose -f docker-compose.yml up
```
EXPOSED: https://localhost:4701
```
Microsoft Visual Studio Enterprise 2019 Preview
Version 16.3.0 Preview 3.0
VisualStudio.16.Preview/16.3.0-pre.3.0+29230.61
Microsoft .NET Framework
Version 4.8.03752
```
# INSECURE
Calling gRPC from inside docker-compose or kubernetes is all over http, so the following needs to be set for those calls to succeed.
// This switch must be set before creating the GrpcChannel/HttpClient.
AppContext.SetSwitch("System.Net.Http.SocketsHttpHandler.Http2UnencryptedSupport", true);
[ms docs](https://docs.microsoft.com/en-us/aspnet/core/grpc/troubleshoot?view=aspnetcore-3.0#call-insecure-grpc-services-with-net-core-client)
Call insecure gRPC services with .NET Core client
Additional configuration is required to call insecure gRPC services with the .NET Core client. The gRPC client must set the System.Net.Http.SocketsHttpHandler.Http2UnencryptedSupport switch to true and use http in the server address:
```
// This switch must be set before creating the GrpcChannel/HttpClient.
AppContext.SetSwitch("System.Net.Http.SocketsHttpHandler.Http2UnencryptedSupport", true);
// The port number(5000) must match the port of the gRPC server.
var channel = GrpcChannel.ForAddress("http://localhost:5000");
var client = new Greet.GreeterClient(channel);
```