{"id":37046802,"url":"https://github.com/overtly/core-grpc","last_synced_at":"2026-01-14T05:31:09.482Z","repository":{"id":41259808,"uuid":"159925304","full_name":"overtly/core-grpc","owner":"overtly","description":"C# Grpc、Consul结合驱动封装，Overt.Core.Grpc基于Consul/Grpc实现服务注册服务发现，支持dotnetcore / framework，可快速实现基于Grpc的微服务；另外Overt.Core.Grpc.H2基于Consul/Grpc.Net实现服务注册服务发现，支持Net5.0， 内部有完整案例，包含服务端Server 客户端 Client，core+grpc, netcore+grpc, dotnetcore+grpc","archived":false,"fork":false,"pushed_at":"2024-07-22T04:48:28.000Z","size":271,"stargazers_count":285,"open_issues_count":0,"forks_count":70,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-10-26T07:22:05.719Z","etag":null,"topics":["consul","core","dotnetcore","grpc","netcore"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/overtly.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-12-01T08:39:59.000Z","updated_at":"2025-09-22T03:12:17.000Z","dependencies_parsed_at":"2022-07-16T23:46:18.625Z","dependency_job_id":null,"html_url":"https://github.com/overtly/core-grpc","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/overtly/core-grpc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/overtly%2Fcore-grpc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/overtly%2Fcore-grpc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/overtly%2Fcore-grpc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/overtly%2Fcore-grpc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/overtly","download_url":"https://codeload.github.com/overtly/core-grpc/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/overtly%2Fcore-grpc/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28410594,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T01:52:23.358Z","status":"online","status_checked_at":"2026-01-14T02:00:06.678Z","response_time":107,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["consul","core","dotnetcore","grpc","netcore"],"created_at":"2026-01-14T05:31:08.795Z","updated_at":"2026-01-14T05:31:09.475Z","avatar_url":"https://github.com/overtly.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"如有疑问可直接加QQ：2292709323，微信：yaofengv，联系\n\n- [Overt.Core.Grpc - Base Grpc.Core 谷歌自带](#overtcoregrpc)\n- [Overt.Core.Grpc.H2 - Base Grpc.Net 微软自带](#overtcoregrpch2)\n\n\n\n# Overt.Core.Grpc\n\n### 项目层次说明\n\n\u003e Overt.Core.Grpc v1.0.6  \n\u003e 基于Google的Grpc.Core驱动，适用于Console服务场景，基于TCP长连接实现微服务场景\n\n#### 1. 项目目录\n\n```\n|-Config                                        配置模型\n|\n|-Client                                        客户端功能实现，服务发现\n|\n|-dllconfigs                                    配置文件保存\n|\n|-Intercept                                     拦截器\n|-|-IServerTracer                               服务端拦截器接口\n|-|-IClientTracer                               客户端拦截器接口\n|  \n|-Manager                                       启动、客户端调用类\n|-|-GrpcServiceManager.cs                       服务端启动类\n|-|-GrpcClientManager.cs                        客户端获取Client类\n|\n|-Service                                       服务端\n|\n|-GrpcServiceCollectionExtensions.cs            netcore注入\n```\n\n#### 2. 版本及支持\n\n\u003e - Nuget版本：v1.0.6\n\u003e - 框架支持： Framewok 4.5 - 4.6 / NetStandard 2.0\n\n\n\n#### 3. 项目依赖\n\n\u003e - NetStandard 2.0\n\n\n```csharp\nConsul 0.7.2.6  \nGoogle.Protobuf 3.8.0\nGrpc 1.21.0\nMicrosoft.Extensions.Configuration.Json 2.0.0\nMicrosoft.Extensions.Options.ConfigurationExtensions 2.0.0\n```\n\n\u003e - Framwork 4.5 - 4.7\n\n```csharp\nConsul 0.7.2.6  \nGoogle.Protobuf 3.8.0\nGrpc 1.21.0\n```\n\n### 使用\n\n#### 1. Nuget包引用\n\n```csharp\nInstall-Package Overt.Core.Grpc -Version 1.0.6\n```\n\n\u003ca name=\"dhmwfy\"\u003e\u003c/a\u003e\n#### 2. 配置信息\n\n优先级：{第三方配置中心} \u003e 环境变量 \u003e  Host内部配置 \u003e 自动取IP**内网**\n\n##### （1）服务端配置信息\n\n\u003e - 支持默认配置文件appsettings.json [Consul节点可不要，如无则不是集群]\n\n\n```json\n{\n  \"GrpcServer\": {\n    \"Service\": {\n      \"Name\": \"OvertGrpcServiceApp\",                    // 服务名称使用服务名称去除点：OvertGrpcServiceApp\n      \"Host\": \"service.g.lan\",                          // 专用注册的域名 （可选）格式：ip[:port=default]\n      \"HostEnv\": \"serviceaddress\",                      // 获取注册地址的环境变量名字（可选，优先）环境变量值格式：ip[:port=default]\n      \"Port\": 10001,                                    // 端口自定义\n      \"Consul\": {\n        \"Path\": \"dllconfigs/consulsettings.json\"        // Consul路径\n      }\n    }\n  }\n}\n```\n\n```xml\n// 添加section\n\u003cconfigSections\u003e\n  \u003csection name=\"grpcServer\" type=\"Overt.Core.Grpc.GrpcServerSection, Overt.Core.Grpc\" /\u003e\n\u003c/configSections\u003e\n\n// 添加节点\n\u003cgrpcServer\u003e\n  \u003cservice name=\"OvertGrpcServiceApp\" port=\"10005\" host=\"专用注册的域名（可选）格式：ip[:port=default]\" hostEnv=\"获取注册地址的环境变量名字（可选）环境变量值格式：ip[:port=default]\"\u003e\n    \u003cregistry\u003e\n      \u003cconsul path=\"dllconfigs/Consul.config\" /\u003e\n    \u003c/registry\u003e\n  \u003c/service\u003e\n\u003c/grpcServer\u003e\n```\n\n##### （2）客户端配置信息\n\n\u003e - 命名：[命名空间].dll.json 文件夹(dllconfigs)\n\n```json\n{\n  \"GrpcClient\": {\n    \"Service\": {\n      \"Name\": \"grpcservice\",                        // 服务名称与服务端保持一致\n      \"MaxRetry\":  0,                               // 最大可重试次数，默认不重试\n      \"Discovery\": {\n        \"EndPoints\": [                              // 单点模式\n          {\n            \"Host\": \"127.0.0.1\",\n            \"Port\": 10001\n          }\n        ],\n        \"Consul\": {                                 // Consul集群,集群优先原则\n          \"Path\": \"dllconfigs/consulsettings.json\"\n        }\n      }\n    }\n  }\n}\n```\n\n```xml\n\u003c?xml version=\"1.0\" encoding=\"utf-8\" ?\u003e\n\u003cconfiguration\u003e\n  \u003cconfigSections\u003e\n    \u003csection name=\"grpcClient\" type=\"Overt.Core.Grpc.GrpcClientSection, Overt.Core.Grpc\"/\u003e\n  \u003c/configSections\u003e\n\n  \u003cgrpcClient\u003e\n    \u003cservice name=\"\" maxRetry=\"0\"\u003e\n      \u003cdiscovery\u003e\n        \u003cserver\u003e\n          \u003cendpoint host=\"\" port=\"\"\u003e\u003c/endpoint\u003e\n          \u003cendpoint host=\"\" port=\"\"\u003e\u003c/endpoint\u003e\n        \u003c/server\u003e\n        \u003cconsul path=\"dllconfigs/Consul.config\"\u003e\u003c/consul\u003e\n      \u003c/discovery\u003e\n    \u003c/service\u003e\n  \u003c/grpcClient\u003e\n\u003c/configuration\u003e\n```\n\n##### （3）Consul配置文件\n\n\u003e - 命名：consulsettings.json 不要改动\n\n```json\n{\n  \"ConsulServer\": {\n    \"Service\": {\n      \"Address\": \"http://consul.g.lan\"     // 默认8500端口\n    }\n  }\n}\n```\n\n```xml\n\u003c?xml version=\"1.0\" encoding=\"utf-8\" ?\u003e\n\u003cconfiguration\u003e\n  \u003cconfigSections\u003e\n    \u003csection name=\"consulServer\" type=\"Overt.Core.Grpc.ConsulServerSection, Overt.Core.Grpc\"/\u003e\n  \u003c/configSections\u003e\n  \u003cconsulServer\u003e\n    \u003cservice address=\"http://consul.g.lan\"\u003e\u003c/service\u003e\n  \u003c/consulServer\u003e\n\u003c/configuration\u003e\n```\n\n#### 3. 服务端的使用\n\n#### （1）NetCore\n\n\u003e - 强制依赖注入模式\n\n```csharp\nservices.AddSingleton\u003cGrpcExampleService.GrpcExampleServiceBase, GrpcExampleServiceImpl\u003e();          // Grpc服务的实现\nservices.AddSingleton\u003cIHostedService, GrpcExampleHostedService\u003e();                                   // Grpc服务启动服务类：如下\nservices.AddGrpcTracer\u003cConsoleTracer\u003e();                                                             // Grpc注入拦截器，继承IServerTracer（可选）\n\n// 使用第三方配置\nservices.AddGrpcConfig(config =\u003e \n{\n    // 以配置中心apollo为例\n    config.AddApollo(context.Configuration.GetSection(\"apollo\")).AddDefault();\n});\n```\n\n```csharp\nusing Microsoft.Extensions.Hosting;\nusing Overt.Core.Grpc;\nusing Overt.GrpcExample.Service.Grpc;\nusing System.Threading;\nusing System.Threading.Tasks;\n\nnamespace Overt.GrpcService.App\n{\n    public class GrpcService : IHostedService\n    {\n        GrpcExampleService.GrpcExampleServiceBase _grpcServiceBase;\n        IServerTracer _tracer;\n        public GrpcService(GrpcExampleService.GrpcExampleServiceBase serviceBase, IServerTracer tracer)         // 依赖注入Grpc服务基础类\n        {\n            _serviceBase = serviceBase;\n            _tracer = tracer;\n        }\n\n\n        public Task StartAsync(CancellationToken cancellationToken)\n        {\n            return Task.Factory.StartNew(() =\u003e\n            {\n                GrpcServiceManager.Start(GrpcExampleService.BindService(_serviceBase), _tracer);\n            }, cancellationToken);\n        }\n\n        public Task StopAsync(CancellationToken cancellationToken)\n        {\n            return Task.Factory.StartNew(() =\u003e\n            {\n                GrpcServiceManager.Stop();\n            }, cancellationToken);\n        }\n    }\n}\n```\n\n\u003e - 实现类写法\n\n```csharp\n原因：服务启动的时候是一个单例，那么所有服务之下的全部是单实例，而数据层需要使用多实例\n\n// 只注入 IServiceProvider\nIServiceProvider _provider;\npublic GrpcExampleServiceImpl(IServiceProvider provider)\n{\n    _provider = provider;\n}\n\n// 其他利用provider即时获取\nusing(var scope = _provider.CreateSocpe())\n{\n    var _userService = scope.ServiceProvider.GetService\u003cIUserService\u003e();\n}\n```\n\n#### （2）Framework 4.6\n\u003e - 直接调用GrpcServiceManager来启动\n\n```csharp\nusing Grpc.Core;\nusing Overt.Core.Grpc;\nusing Overt.Log;\nusing System;\n\nnamespace Overt.GrpcService\n{\n    public class MainService\n    {\n        public MainService()\n        {\n            \n        }\n        public void Start(string serviceName)               // 启动服务\n        {\n            GrpcServiceManager.Start(Library.GrpcService.BindService(new GrpcServiceImpl()), tracer: new ConsoleTracer(), whenException: (ex) =\u003e\n            {\n                LogHelper.Info(\"\", ex);\n            });\n        }\n\n        public void Stop(string serviceName)                // 停止服务\n        {\n            GrpcServiceManager.Stop();\n        }\n        public void ShutDown(string serviceName)\n        {\n            GrpcServiceManager.Stop();\n        }\n    }\n}\n```\n\n#### 4. 客户端使用\n\n#### （1）NetCore\n\n\u003e - 强制依赖注入模式\n\u003e - 配置文件默认使用    [命名空间].dll.json     可通过vs.menu工具生成nuget包\n\u003e - 注入中直接调用如下\n\n\n```csharp\n// 注入Grpc客户端\nservices.AddGrpcClient();\n\n// 自定义配置文件 / 默认使用命名空间.dll.json\nservices.Configure\u003cGrpcClientOptions\u003cGrpcExampleServiceClient\u003e\u003e((cfg) =\u003e\n{\n    cfg.ConfigPath = \"dllconfig/Overt.GrpcExample.Service.Grpc.dll.json\";  // 可不传递\n});\n\n// 使用第三方配置\nservices.AddGrpcConfig(config =\u003e \n{\n    // 以配置中心apollo为例\n    config.AddApollo(context.Configuration.GetSection(\"apollo\")).AddDefault();\n});\n\n\n// 获取注入的对象\nIGrpcClient\u003cGrpcExampleServiceClient\u003e _grpcClient;\npublic IndexModel(IGrpcClient\u003cGrpcExampleServiceClient\u003e grpcClient)\n{\n    _grpcClient = grpcClient;\n}\n\n\nvar res = _grpcClient.Client.Ask(new Service.Grpc.AskRequest() { Key = \"abc\" });\n```\n\n#### （2）Framework\n\n\u003e - 客户端代理类，编译在Dll中，源码如下，可忽略\n\n```csharp\nusing Grpc.Core;\nusing Overt.Core.Grpc;\nusing Overt.Core.Grpc.Intercept;\nusing System;\nusing System.Collections.Concurrent;\nusing System.IO;\nusing __GrpcService = Overt.GrpcExample.Service.Grpc.GrpcExampleService;\nnamespace Overt.GrpcExample.Service.Grpc\n{\n#if NET45 || NET46 || NET47\n    public class ClientManager\n    {\n        public static IClientTracer Tracer { get; set; } = default(IClientTracer);\n        private static string DefaultConfigPath { get; set; } = \"dllconfigs/Overt.GrpcExample.Service.Grpc.dll.config\";\n        public static __GrpcService.GrpcExampleServiceClient Instance\n        {\n            get\n            {\n                return ClientManager\u003c__GrpcService.GrpcExampleServiceClient\u003e.Instance;\n            }\n        }\n        private static readonly ConcurrentDictionary\u003cType, string\u003e configMap = new ConcurrentDictionary\u003cType, string\u003e();\n        public static void Configure\u003cT\u003e(string configPath) { configMap.AddOrUpdate(typeof(T), configPath, (t, s) =\u003e configPath); }\n        public static string GetConfigure\u003cT\u003e() { if (configMap.TryGetValue(typeof(T), out string configPath)) return configPath; return DefaultConfigPath; }\n    }\n    public class ClientManager\u003cT\u003e : ClientManager where T : ClientBase\n    {\n        public static new T Instance\n        {\n            get\n            {\n                var configPath = GetConfigure\u003cT\u003e();\n                var abConfigPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, configPath);\n                return GrpcClientManager\u003cT\u003e.Get(abConfigPath, Tracer);\n            }\n        }\n    }\n#endif\n}\n```\n\n\u003e - 使用代理类执行\n```\n// 自定义配置文件 / 默认使用命名空间.dll.json / 在主进程入口进行配置T为服务Client\nClientManger.Configure\u003cT\u003e(\"dllconfig/abc.config\");\n\nClientManager.Instance.[Method]\n\n// T为服务Client\nClientManager\u003cT\u003e.Instance.[Method]\n```\n\n#### 5. 更新说明\n\n- 2024-07-22 v1.0.9\n\u003e 1. consul支持Token\n\n\n- 2022-04-06 v1.0.8\n\u003e 1. 升级底层驱动为最新版本\n\u003e 2. Grpc =\u003e 2.40.0\n\n\n- 2021-07-01 v1.0.7\n\u003e 1. 升级底层驱动为最新版本\n\u003e 2. Google.Protobuf =\u003e 3.17.3\n\n\n- 2021-03-31 v1.0.6\n\u003e 1. 重构GrpcClientOptions\n\u003e 2. 升级驱动为最新版本\n\n\n- 2021-03-30 v1.0.5\n\u003e 1. Tracer提供修改Channel Target能力，可供外部自定义选择节点；\n\u003e 2. 升级底层驱动为最新版本\n\u003e 3. 增加自定义Interceptor的注入\n\u003e 4. 调整ServiceStart的参数配置，使用GrpcOptions进行承接\n\u003e 5. 增加invokers的自定义获取，增加ServiceId的获取\n\u003e 6. 支持framework版本的自定义invoker获取策略\n\n\n- 2021-02-25 v1.0.4.1\n\u003e 1. 增加第三方配置的支持，比如apollo，可使用services.AddGrpcConfig进行扩展(目前仅支持dotnetcore)\n\n\n- 2019-11-28 v1.0.3.1\n\u003e 1. 优化对Consul新版本的支持\n\n\n- 2019-11-28 v1.0.3 \n\u003e 1. 注册中心监听到变动后，忽略黑名单，本地连接全部重置\n\n\n- 2019-09-29 v1.0.2\n\u003e 1. 客户端使用Consul注册中心，支持单服务变动监听，新注册服务或者服务挂掉，更加实时\n\n\n- 2019-08-16 v1.0.1\n\u003e 1. 支持多服务模式\n\n\n- 2019-08-01 v1.0.0\n\u003e 1. 修改命名空间，更新nuget包为Overt.Core.Grpc 更新默认版本为1.0.0\n\n\n- 2019-06-05 v1.0.0.1\n\u003e 1. 客户端优化连接服务失败的情况下，拉入黑名单，导致节点不存在的问题\n\n\n\n\n\n\n\n\n\n\n# Overt.Core.Grpc.H2\n\n### 项目层次说明\n\n\u003e Overt.Core.Grpc.H2 v2.0.1  \n\u003e 用于\u003e= netcoreapp3.0版本，用于http2协议，依赖微软的grpc.net，适用于Web服务场景，基于http2实现微服务场景\n\n#### 1. 项目目录\n\n```\n|-Config                                        配置模型\n|\n|-Client                                        客户端功能实现，服务发现\n|\n|-dllconfigs                                    配置文件保存\n|\n|-Service                                       服务端\n|\n|-GrpcServiceCollectionExtensions.cs            netcore注入\n```\n\n#### 2. 版本及支持\n\n\u003e - Nuget版本：V 2.0.1\n\n\u003e - 框架支持： netstandard2.1 / netcoreapp3.0 / net5.0 / net6.0\n\n\n\n#### 3. 项目依赖\n\n```csharp\nConsul 1.6.10.7\nGoogle.Protobuf 3.21.5\nGrpc.Net.Client 2.47.0\nMicrosoft.Extensions.Configuration.Json 5.0.0\nMicrosoft.Extensions.Options.ConfigurationExtensions 5.0.0\n```\n\n### 使用\n\n#### 1. Nuget包引用\n\n```csharp\nInstall-Package Overt.Core.Grpc.H2 -Version 2.1.0\n```\n\n\u003ca name=\"dhmwfy\"\u003e\u003c/a\u003e\n#### 2. 配置信息\n\n优先级：{第三方配置中心} \u003e 环境变量 \u003e  Host内部配置 \u003e 自动取IP+启动端口**内网**\n\n##### （1）服务端配置信息\n\n\u003e - 支持默认配置文件appsettings.json [Consul节点可不要，如无则不是集群]\n\n\n```json\n{\n  \"GrpcServer\": {\n    \"Service\": {\n      \"Name\": \"OvertGrpcServiceApp\",                    // 服务名称使用服务名称去除点：OvertGrpcServiceApp\n      \"Host\": \"service.g.lan\",                          // 专用注册的域名 （可选）格式：ip[:port=default]\n      \"HostEnv\": \"serviceaddress\",                      // 获取注册地址的环境变量名字（可选，优先）环境变量值格式：ip[:port=default]\n      \"Port\": 10001,                                    // 端口自定义\n      \"Consul\": {\n        \"Path\": \"dllconfigs/consulsettings.json\"        // Consul路径\n      }\n    }\n  }\n}\n```\n\n##### （2）客户端配置信息\n\n\u003e - 命名：[命名空间].dll.json 文件夹(dllconfigs)\n\n```json\n{\n  \"GrpcClient\": {\n    \"Service\": {\n      \"Name\": \"grpcservice\",                        // 服务名称与服务端保持一致\n      \"Scheme\":  \"http\",                            // foraddress 协议 http/https\n      \"Discovery\": {\n        \"EndPoints\": [                              // 单点模式\n          {\n            \"Host\": \"127.0.0.1\",\n            \"Port\": 10001\n          }\n        ],\n        \"Consul\": {                                 // Consul集群,集群优先原则\n          \"Path\": \"dllconfigs/consulsettings.json\"\n        }\n      }\n    }\n  }\n}\n```\n\n\n##### （3）Consul配置文件\n\n\u003e - 命名：consulsettings.json 不要改动\n\n```json\n{\n  \"ConsulServer\": {\n    \"Service\": {\n      \"Address\": \"http://consul.g.lan\"     // 默认8500端口\n    }\n  }\n}\n```\n\n\n#### 3. 服务端的使用\n\n\u003e - 注册Consul\n\n```csharp\npublic void ConfigureServices(IServiceCollection services)\n{\n  ...\n  // 其他\n  ...\n  \n  services.AddGrpcService(); // 应用关闭时，节点可自动移除\n  // 按需使用第三方配置\n  services.AddGrpcConfig(config =\u003e \n  {\n      // 以配置中心apollo为例\n      config.AddApollo(context.Configuration.GetSection(\"apollo\")).AddDefault();\n  });\n  \n}\n\npublic void Configure(IApplicationBuilder app, IWebHostEnvironment env)\n{\n  ...\n  // 其他\n  ...\n  \n  app.UseGrpcRegister();\n}\n\n\n```\n\n#### 4. 客户端使用\n\u003e - 强制依赖注入模式\n\u003e - 配置文件默认使用    [命名空间].dll.json     可通过vs.menu工具生成nuget包\n\u003e - 注入中直接调用如下\n\n\n```csharp\n// 注入Grpc客户端\nservices.AddGrpcClient();\n\n// 自定义配置文件 / 默认使用命名空间.dll.json\nservices.Configure\u003cGrpcClientOptions\u003cGrpcExampleServiceClient\u003e\u003e((cfg) =\u003e\n{\n    cfg.ConfigPath = \"dllconfig/Overt.GrpcExample.Service.Grpc.dll.json\";  // 可不传递\n});\n\n// 使用第三方配置\nservices.AddGrpcConfig(config =\u003e \n{\n    // 以配置中心apollo为例\n    config.AddApollo(context.Configuration.GetSection(\"apollo\")).AddDefault();\n});\n\n\n// 获取注入的对象\nIGrpcClient\u003cGrpcExampleServiceClient\u003e _grpcClient;\npublic IndexModel(IGrpcClient\u003cGrpcExampleServiceClient\u003e grpcClient)\n{\n    _grpcClient = grpcClient;\n}\n\n\nvar res = _grpcClient.Client.Ask(new Service.Grpc.AskRequest() { Key = \"abc\" });\n```\n\n\n#### 5. 更新说明\n\n- 2022-08-24 v2.0.1\n\u003e 1.NET5_0_OR_GREATER支持subchannel，支持Resolver以及LoadBalancer，支持自定义\n\n\n- 2021-12-30 v1.0.5\n\u003e 1. 支持apollo等外部配置中心\n\n\n- 2021-03-31 v1.0.4\n\u003e 1. 支持代码更改文件配置\n\u003e 2. 增加HostedService\n\n\n- 2021-03-30 v1.0.1\n\u003e 1. 第一个版本，依赖微软的驱动grpc.net，适应net5.0\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fovertly%2Fcore-grpc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fovertly%2Fcore-grpc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fovertly%2Fcore-grpc/lists"}