MinGo.ServiceRegistry.Client
0.1.1
dotnet add package MinGo.ServiceRegistry.Client --version 0.1.1
NuGet\Install-Package MinGo.ServiceRegistry.Client -Version 0.1.1
<PackageReference Include="MinGo.ServiceRegistry.Client" Version="0.1.1" />
<PackageVersion Include="MinGo.ServiceRegistry.Client" Version="0.1.1" />
<PackageReference Include="MinGo.ServiceRegistry.Client" />
paket add MinGo.ServiceRegistry.Client --version 0.1.1
#r "nuget: MinGo.ServiceRegistry.Client, 0.1.1"
#:package MinGo.ServiceRegistry.Client@0.1.1
#addin nuget:?package=MinGo.ServiceRegistry.Client&version=0.1.1
#tool nuget:?package=MinGo.ServiceRegistry.Client&version=0.1.1
MinGo Service Registry SDK
核心抽象 + 客户端 SDK。本仓库只产出 NuGet 包,不包含可独立运行的 Registry Server(见 service-registry 仓库)。
包划分
| 包 | 职责 |
|---|---|
MinGo.ServiceRegistry.Abstractions |
领域模型、协议 DTO、IServiceRegistryClient 抽象、JSON 源生成上下文 |
MinGo.ServiceRegistry.Client |
基于 HttpClient 的 Registry 协议客户端实现 |
MinGo.ServiceRegistry.AspNetCore |
AddServiceRegistry(...) + 注册/心跳/注销的 IHostedService |
MinGo.ServiceRegistry.ServiceDiscovery |
对接 Microsoft.Extensions.ServiceDiscovery 的终结点 Provider |
MinGo.ServiceRegistry |
聚合上述四包的元包,业务服务一键安装 |
依赖方向
Abstractions <- Client <- AspNetCore
\- ServiceDiscovery
快速开始
var builder = WebApplication.CreateBuilder(args);
// 1. 作为服务提供方:注册自身 + 心跳
builder.Services.AddServiceRegistry(o =>
{
o.ServiceName = "user-service";
o.RegistryEndpoint = new Uri("https://registry:8500");
});
// 2. 作为服务消费方:通过服务名调用(生产用 Registry Provider)
builder.Services.AddRegistryServiceDiscovery();
builder.Services.AddHttpClient<UserServiceClient>(c => c.BaseAddress = new Uri("https://user-service"))
.AddServiceDiscovery();
本地开发可改用官方 Configuration Provider(builder.Services.AddServiceDiscovery(); + appsettings.json 的 Services 节点),业务代码不变。详见 docs/local-development.md。
构建
dotnet build ServiceRegistry.Sdk.slnx
dotnet test ServiceRegistry.Sdk.slnx
dotnet pack ServiceRegistry.Sdk.slnx -c Release -o ./artifacts
目标框架
net10.0
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.12)
- Microsoft.Extensions.Http (>= 10.0.12)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.12)
- Microsoft.Extensions.Options (>= 10.0.12)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 10.0.12)
- Microsoft.Extensions.Primitives (>= 10.0.12)
- MinGo.ServiceRegistry.Abstractions (>= 0.1.1)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on MinGo.ServiceRegistry.Client:
| Package | Downloads |
|---|---|
|
MinGo.ServiceRegistry.AspNetCore
ASP.NET Core host integration for MinGo Service Registry: automatic registration, heartbeat and deregistration. |
|
|
MinGo.ServiceRegistry
Meta package that installs the full MinGo Service Registry SDK (Abstractions, Client, AspNetCore, ServiceDiscovery). |
GitHub repositories
This package is not used by any popular GitHub repositories.