.net core 原生支持grpc
This is a guest post by Sourabh Shirhatti, a Program Manger on the .NET team at Microsoft.
The .NET team at Microsoft has been working in close collaboration with the gRPC team since November 2018 on a new fully managed implementation of gRPC for .NET Core.
We’re pleased to announce that grpc-dotnet is now available with .NET Core 3.0 today!
How to get it?
grpc-dotnet packages have just been released to NuGet.org and are already available for use in your projects. These packages also require the latest .NET Core 3.0 shared framework. You can download the .NET Core 3.0 SDK for your dev machine and build servers from the .NET Core 3.0 download page to acquire the shared framework.
Getting Started
As gRPC is now a first-class citizen in .NET ecosystem, gRPC templates are included as part of the .NET SDK. To get started, navigate to a console window after installing the SDK and run the following commands.
dotnet new grpc -o GrpcGreeter
cd GrpcGreeter
dotnet run
To create a gRPC client and test with the newly created gRPC Greeter service, you can follow the rest of this tutorial here.
Doesn’t gRPC already work with .NET Core?
There are currently two official implementations of gRPC for .NET:
- Grpc.Core: The original gRPC C# implementation based on the native gRPC Core library.
- grpc-dotnet: The new implementation written entirely in C# with no native dependencies and based on the newly released .NET Core 3.0.
The implementations coexist side-by-side and each has its own advantages in terms of available features, integrations, supported platforms, maturity level and performance. Both implementations share the same API for invoking and handling RPCs, thus limiting the lock-in and enabling users to choose the implementation that satisfies their needs the best.
What’s new?
Unlike the existing C-Core based implementation (Grpc.Core), the new libraries (grpc-dotnet) make use of the existing networking primitives in the .NET Core Base Class Libraries (BCL). The diagram below highlights the difference between the existing Grpc.Core library and the new grpc-dotnet libraries.

On the server side, the Grpc.AspNetCore.Server
package integrates into ASP.NET Core, allowing developers to benefit from ecosystem of common cross-cutting concerns of logging, configuration, dependency injection, authentication, authorization etc. which have already been solved by ASP.NET Core. Popular libraries in the ASP.NET ecosystem such as Entity Framework Core (ORM), Serilog (Logging library), and Identity Server among others now work seamlessly with gRPC.
On the client side, the Grpc.Net.Client
package builds upon the familiar HttpClient
API that ships as part of .NET Core. As with the server, gRPC clients greatly benefit from the ecosystem of packages that build upon HttpClient
. It is now possible to use existing packages such as Polly(Resilience and fault-handling library) and HttpClientFactory(manage HTTPClient lifetimes) with gRPC clients.
The diagram below captures the exhaustive list of all new .NET packages for gRPC and their relationship with the existing packages.

In addition to the newly published packages that ship as part of grpc-dotnet, we’ve also made improvements that benefit both stacks. Visual Studio 2019 ships with language grammar support for protobuf files and automatic generation of gRPC server/client code upon saving a protobuf file without requiring full project rebuilds due to design-time builds.

.net core 原生支持grpc的更多相关文章
- ASP.NET Core 3.0 gRPC 双向流
目录 ASP.NET Core 3.0 使用gRPC ASP.NET Core 3.0 gRPC 双向流 ASP.NET Core 3.0 gRPC 认证授权 一.前言 在前一文 <ASP.NE ...
- 支持 gRPC 长链接,深度解读 Nacos 2.0 架构设计及新模型
支持 gRPC 长链接,深度解读 Nacos 2.0 架构设计及新模型 原创 杨翊(席翁) 阿里巴巴云原生 2020-12-28
- .NET Core(.NET6)中gRPC注册到Consul
一.简介 上一篇文章介绍了.NET Core 中使用gRPC,在微服务中,我们通常要把服务做成服务注册,服务发现的方式,那么这里来说一下gRPC是如何注册到Consul中的. Consul的安装这里就 ...
- SQL Server 2016 JSON原生支持实例说明
背景 Microsoft SQL Server 对于数据平台的开发者来说越来越友好.比如已经原生支持XML很多年了,在这个趋势下,如今也能在SQLServer2016中使用内置的JSON.尤其对于一些 ...
- SQL Server2016 原生支持JSON
SQL Server2016 原生支持JSON SQL Server 2005 开始支持 XML 数据类型,提供原生的 XML数据类型.XML 索引以及各种管理 XML 或输出 XML 格式的函数. ...
- 【python cookbook】【数据结构与算法】14.对不原生支持比较操作的对象排序
问题:想在同一个类的实例之间做排序,但是它们并不原生支持比较操作. 解决方案:使用内建的sorted()函数可接受一个用来传递可调用对象的参数key,sorted利用该可调用对象返回的待排序对象中的某 ...
- SQL Server 2016原生支持JSON
转载原地址: http://www.cnblogs.com/lyhabc/p/4747694.html SQL Server 2005 开始支持 XML 数据类型,提供原生的 XML数据类型.XML ...
- 使Asp.net Core同时支持输出Json/Xml
我们知道Asp.net Core是支持输出为Json格式的.同时也支持输出为xml格式.只要我们正确的配置.并在Request时指定正确的Accept,即可根据不同的Header来输出不同的格式. 前 ...
- Windows10 64位下安装TensorFlow谷歌人工智能系统已官方原生支持
Windows10 64位下安装TensorFlow谷歌人工智能系统已官方原生支持 GitHub - tensorflow/tensorflow: Computation using data flo ...
随机推荐
- 基于netty手写RPC框架
代码目录结构 rpc-common存放公共类 rpc-interface为rpc调用方需要调用的接口 rpc-register提供服务的注册与发现 rpc-client为rpc调用方底层实现 rpc- ...
- 基于百度地图JavaScript API,员工住址统计
公司一般都有通讯和住址的统计,但是文字化的表格根本就不知道住在哪. 用百度地图就可以轻松解决, 而且公司还经常人员变动,读取excel中的内容,就不用每次还要更改地图文件了. 在遇到需要聚餐在地图中标 ...
- ssh tunneling应用案例-AWS EC2 vnc图形化桌面的支持
一般地,无论是AWS EC2还是阿里云的云主机,linux系统默认都只提供ssh登录方式.如果你是一个技术控,非常希望把图形化界面给折腾出来,这其中就不需有vnc server的支持,除此之外,还涉及 ...
- 使用基础知识完成java小作业?强化练习-1.输入数组计算最大值-2.输出数组反向打印-3.求数组平均值与总和-4.键盘输两int,并求总和-5.键盘输三个int,并求最值;
完成几个小代码练习?让自己更加强大?学习新知识回顾一下基础? 1.输入数组计算最大值 2.输出数组反向打印 3.求数组平均值与总和 4.键盘输两int,并求总和 5.键盘输三个int,并求最值 /* ...
- Python面向对象封装案例
01. 封装 封装 是面向对象编程的一大特点 面向对象编程的 第一步 —— 将 属性 和 方法 封装 到一个抽象的 类 中 外界 使用 类 创建 对象,然后 让对象调用方法 对象方法的细节 都被 封装 ...
- Cat搭建遇坑记
1. Cat搭建遇坑记 1.1. 报错 服务端启动 Unable to get component: class com.dianping.cat.analysis.TcpSocketReceiver ...
- JavaScript 之 Math对象
Math对象 Math 对象不是构造函数,它具有数学常数和函数的属性和方法,都是以静态成员的方式提供. 常用方法: Math.PI // 圆周率 Math.random() // 生成随机数,生成0~ ...
- 搞不懂JS中赋值·浅拷贝·深拷贝的请看这里
前言 百科定义:拷贝就是拷贝指向对象的指针,意思就是说:拷贝出来的目标对象的指针和源对象的指针指向的内存空间是同一块空间,浅拷贝只是一种简单的拷贝,让几个对象公用一个内存,然而当内存销毁的时候,指向这 ...
- Jmeter如何测试接口
现在对测试人员的要求越来越高,不仅仅要做好功能测试,对接口测试的需求也越来越多!所以也越来越多的同学问,怎样才能做好接口测试? 要真正的做好接口测试,并且弄懂如何测试接口,需要从如下几个方面去分析问题 ...
- rest framework 之视图
一.APIView APIView 直接继承 View(Django 内置的 View),也就是说 APIView 是最贴近原生 Django 的 View 的. 因此可定制程度高,根据请求方法不同执 ...