![]() |
VOOZH | about |
dotnet add package Galosys.Foundation.NacosNaming --version 26.5.20.1
NuGet\Install-Package Galosys.Foundation.NacosNaming -Version 26.5.20.1
<PackageReference Include="Galosys.Foundation.NacosNaming" Version="26.5.20.1" />
<PackageVersion Include="Galosys.Foundation.NacosNaming" Version="26.5.20.1" />Directory.Packages.props
<PackageReference Include="Galosys.Foundation.NacosNaming" />Project file
paket add Galosys.Foundation.NacosNaming --version 26.5.20.1
#r "nuget: Galosys.Foundation.NacosNaming, 26.5.20.1"
#:package Galosys.Foundation.NacosNaming@26.5.20.1
#addin nuget:?package=Galosys.Foundation.NacosNaming&version=26.5.20.1Install as a Cake Addin
#tool nuget:?package=Galosys.Foundation.NacosNaming&version=26.5.20.1Install as a Cake Tool
成熟度: 🟡 可用 — 功能完整,测试或文档可能不完善
基于 Nacos 的服务注册与发现模块,提供服务注册、发现及相关扩展功能。
Nacos.SDKMicrosoft.Extensions.OptionsMicrosoft.Extensions.ServiceDiscovery在 appsettings.json 中配置 Nacos 相关参数:
{
"Nacos": {
"ServerAddr": ["http://localhost:8848"],
"UserName": "nacos",
"Password": "nacos",
"ClusterName": "DEFAULT",
"GroupName": "DEFAULT_GROUP",
"RegisterEnabled": true,
"AccessKey": "",
"SecretKey": "",
"Endpoint": ""
}
}
| 配置项 | 类型 | 默认值 | 说明 |
|---|---|---|---|
ServerAddr |
List<string> |
- | Nacos 服务器地址 |
UserName |
string |
- | 用户名 |
Password |
string |
- | 密码 |
ClusterName |
string |
DEFAULT |
集群名称 |
GroupName |
string |
DEFAULT_GROUP |
分组名称 |
RegisterEnabled |
bool |
true |
是否启用服务注册 |
AccessKey |
string |
- | 访问密钥 |
SecretKey |
string |
- | _secretKey 密钥 |
Endpoint |
string |
- | 端点地址 |
模块会自动将服务注册到 Nacos,无需手动配置:
// 自动从环境变量获取服务地址和端口进行注册
// 服务名称自动从环境变量或配置中获取
通过 HTTP 端点调用其他已注册服务:
// 使用 HttpClient 直接请求 Nacos 注册的服务
// 格式: http://{服务名}
获取健康服务实例地址:
var instance = await nacosNamingService.SelectOneHealthyInstance(
serviceName,
groupName,
clusterList,
healthyOnly
);
instance.TryGetHealthyUrl(out var url);
// url 格式: http://ip:port
RegisterEnabled 禁用注册功能,适用于网关等场景| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 net8.0 is compatible. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
Showing the top 2 NuGet packages that depend on Galosys.Foundation.NacosNaming:
| Package | Downloads |
|---|---|
|
Galosys.Foundation.Yarp.NacosNaming
Galosys.Foundation快速开发库 |
|
|
Galosys.Micro.App
Galosys.Foundation快速开发库 |
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 26.5.20.1 | 114 | 5/20/2026 |
| 26.5.19.1 | 102 | 5/19/2026 |
| 26.5.18.1 | 116 | 5/18/2026 |
| 26.5.15.1 | 114 | 5/15/2026 |
| 26.5.12.3 | 118 | 5/12/2026 |
| 26.5.12.2 | 96 | 5/12/2026 |
| 26.4.27.1-rc1 | 107 | 4/26/2026 |
| 26.4.25.1-rc1 | 102 | 4/25/2026 |
| 26.4.22.2-rc7 | 109 | 4/22/2026 |
| 26.4.22.2-rc6 | 102 | 4/22/2026 |
| 26.4.22.2-rc4 | 102 | 4/22/2026 |
| 26.4.22.2-rc3 | 107 | 4/22/2026 |
| 26.4.19.1-rc1 | 106 | 4/19/2026 |
| 26.4.12.8-rc1 | 114 | 4/12/2026 |
| 26.4.12.7-rc1 | 110 | 4/12/2026 |
| 26.4.12.5-rc1 | 92 | 4/12/2026 |
| 26.1.30.1-rc1 | 172 | 1/30/2026 |
| 26.1.29.1 | 172 | 1/29/2026 |
| 26.1.28.5 | 160 | 1/28/2026 |
| 26.1.28.4 | 166 | 1/28/2026 |