MinGo.ServiceRegistry.AspNetCore
0.1.1
dotnet add package MinGo.ServiceRegistry.AspNetCore --version 0.1.1
NuGet\Install-Package MinGo.ServiceRegistry.AspNetCore -Version 0.1.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="MinGo.ServiceRegistry.AspNetCore" Version="0.1.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MinGo.ServiceRegistry.AspNetCore" Version="0.1.1" />
<PackageReference Include="MinGo.ServiceRegistry.AspNetCore" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add MinGo.ServiceRegistry.AspNetCore --version 0.1.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: MinGo.ServiceRegistry.AspNetCore, 0.1.1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package MinGo.ServiceRegistry.AspNetCore@0.1.1
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=MinGo.ServiceRegistry.AspNetCore&version=0.1.1
#tool nuget:?package=MinGo.ServiceRegistry.AspNetCore&version=0.1.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net10.0
- MinGo.ServiceRegistry.Client (>= 0.1.1)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on MinGo.ServiceRegistry.AspNetCore:
| Package | Downloads |
|---|---|
|
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.