NetPro.ConsulClient
6.0.5-beta.7
.NET 6.0
This package targets .NET 6.0. The package is compatible with this framework or higher.
.NET Core 3.1
This package targets .NET Core 3.1. The package is compatible with this framework or higher.
This is a prerelease version of NetPro.ConsulClient.
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package NetPro.ConsulClient --version 6.0.5-beta.7
NuGet\Install-Package NetPro.ConsulClient -Version 6.0.5-beta.7
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="NetPro.ConsulClient" Version="6.0.5-beta.7" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add NetPro.ConsulClient --version 6.0.5-beta.7
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: NetPro.ConsulClient, 6.0.5-beta.7"
#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.
// Install NetPro.ConsulClient as a Cake Addin #addin nuget:?package=NetPro.ConsulClient&version=6.0.5-beta.7&prerelease // Install NetPro.ConsulClient as a Cake Tool #tool nuget:?package=NetPro.ConsulClient&version=6.0.5-beta.7&prerelease
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
NetPro.Proxy使用
Consul 客户端
使用
如在容器中使用,需要配置如下LANIP和PORT环境变量,默认便利本机所有网卡地址与分配给程序的默认端口,示例如下: 宿主机IP地址 LANIP=192.168.1.1 PORT 端口号 PORT=5000
appsetting.json
- 增加以下配置节点
"ConsulOption": {
"Enabled": false, //是否开启,不配置默认开启
"ServiceName": "xxx.api", //可留空;留空默认以入口程序名作为servicename
"EndPoint": "http://localhost:8500",
"WaitTime": null,
"Tags": [ "HUHU" ], //可留空
"Datacenter": null, //可留空
"Token": null //可留空
}
如果基于NetPro.WebApi的项目,只需要以上配置即可,如不是基于NetPro.WebApi的项目,需手动按一下初始化组件
启用服务
public void ConfigureServices(IServiceCollection services, IConfiguration configuration = null)
{
services.AddConsul(configuration);
}
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
}
ublic class ConsulDemoController : ControllerBase
{
private readonly ILogger<TimeZoneDemoController> _logger;
private readonly IConsulClient _consulClient;
/// <summary>
///
/// </summary>
/// <param name="logger"></param>
/// <param name="consulClient"></param>
public TimeZoneDemoController(ILogger<TimeZoneDemoController> logger,
IConsulClient consulClient)
{
_logger = logger;
_consulClient=consulClient;
}
/// <summary>
/// consul发现服务
/// </summary>
[HttpGet("DiscoveryServices")]
[ProducesResponseType(200, Type = typeof(ResponseResult))]
public async Task<IActionResult> DiscoveryServices(string serviceName = "XXX.API")
{
//以下几种方式都可拿到注册的服务地址
var result = await _consulClient.Agent.DiscoveryAsync();
var result1 = await _consulClient.Catalog.DiscoveryAsync(serviceName);
var result2 = await _consulClient.DiscoveryAsync(serviceName);
return Ok(new { result, result1, result2 });
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp3.1 is compatible. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETCoreApp 3.1
- NetPro.Consul.AspNetCore (>= 1.7.1-beta.1)
- NetPro.Core (>= 6.0.5-beta.7)
-
net6.0
- NetPro.Consul.AspNetCore (>= 1.7.1-beta.1)
- NetPro.Core (>= 6.0.5-beta.7)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories (1)
Showing the top 1 popular GitHub repositories that depend on NetPro.ConsulClient:
Repository | Stars |
---|---|
LeonKou/NetPro
🌈An enhanced version with clean architecture of asp.netcore,efficiently manage startup,Support for netcore3.1/6.0
|
Version | Downloads | Last updated |
---|---|---|
6.0.16 | 139 | 7/24/2023 |
6.0.15 | 140 | 7/19/2022 |
6.0.14 | 143 | 7/10/2022 |
6.0.13 | 130 | 6/15/2022 |
6.0.12 | 120 | 6/15/2022 |
6.0.11 | 130 | 6/15/2022 |
6.0.10 | 141 | 6/11/2022 |
6.0.9 | 135 | 6/8/2022 |
6.0.8 | 128 | 5/26/2022 |
6.0.8-beta.3 | 503 | 5/24/2022 |
6.0.8-beta.2 | 112 | 5/24/2022 |
6.0.7 | 139 | 5/18/2022 |
6.0.6 | 135 | 4/28/2022 |
6.0.5 | 139 | 3/30/2022 |
6.0.5-beta.20 | 125 | 4/27/2022 |
6.0.5-beta.19 | 120 | 4/25/2022 |
6.0.5-beta.18 | 118 | 4/22/2022 |
6.0.5-beta.17 | 128 | 4/16/2022 |
6.0.5-beta.16 | 194 | 4/8/2022 |
6.0.5-beta.15 | 125 | 4/8/2022 |
6.0.5-beta.14 | 140 | 4/7/2022 |
6.0.5-beta.13 | 127 | 4/7/2022 |
6.0.5-beta.12 | 126 | 4/6/2022 |
6.0.5-beta.11 | 123 | 4/6/2022 |
6.0.5-beta.10 | 128 | 3/31/2022 |
6.0.5-beta.9 | 187 | 3/26/2022 |
6.0.5-beta.8 | 144 | 3/22/2022 |
6.0.5-beta.7 | 144 | 3/21/2022 |
6.0.5-beta.6 | 137 | 3/14/2022 |
6.0.5-beta.5 | 136 | 3/2/2022 |
6.0.5-beta.4 | 130 | 2/22/2022 |
6.0.5-beta.3 | 132 | 2/18/2022 |
6.0.5-beta.2 | 122 | 2/18/2022 |
6.0.5-beta.1 | 133 | 2/16/2022 |
6.0.4 | 459 | 2/10/2022 |
6.0.3 | 443 | 2/9/2022 |
6.0.3-beta.9 | 126 | 2/10/2022 |
6.0.3-beta.7 | 153 | 1/27/2022 |
6.0.3-beta.6 | 136 | 1/19/2022 |
6.0.3-beta.5 | 150 | 1/17/2022 |
6.0.3-beta.4 | 148 | 1/16/2022 |
6.0.3-beta.3 | 145 | 1/14/2022 |
6.0.3-beta.2 | 136 | 1/13/2022 |
6.0.3-beta.1 | 169 | 1/11/2022 |
6.0.2 | 320 | 1/6/2022 |
1.0.0 | 369 | 12/20/2021 |