CBLibrary.ConsulRegister 1.0.1

dotnet add package CBLibrary.ConsulRegister --version 1.0.1
NuGet\Install-Package CBLibrary.ConsulRegister -Version 1.0.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="CBLibrary.ConsulRegister" Version="1.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add CBLibrary.ConsulRegister --version 1.0.1
#r "nuget: CBLibrary.ConsulRegister, 1.0.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.
// Install CBLibrary.ConsulRegister as a Cake Addin
#addin nuget:?package=CBLibrary.ConsulRegister&version=1.0.1

// Install CBLibrary.ConsulRegister as a Cake Tool
#tool nuget:?package=CBLibrary.ConsulRegister&version=1.0.1

Consul服务发现注册帮助组件

CBLibrary.ConsulRegister 1.0.1

Release Notes

Features

  • Consul服务发现注册帮助

Usages

实体
public class ServiceEntity
{
    /// <summary>
    /// 健康检查地址,默认: /api/health
    /// </summary>
    public string HealthCheckUrl { get; set; } = "/api/health";

    /// <summary>
    /// 异常服务定时清理间隔,单位:秒 默认60秒
    /// </summary>
    public int CriticalServiceCleanInterval { get; set; } = 1 * 60;

    /// <summary>
    /// 健康检查间隔,单位:秒 默认5秒
    /// </summary>
    public int HealthCheckInterval { get; set; } = 5;

    /// <summary>
    /// 超时时间,单位:秒 默认10秒
    /// </summary>
    public int Timeout { get; set; } = 10;


    /// <summary>
    /// 服务名称
    /// </summary>
    public string ServiceName { get; set; }

    /// <summary>
    /// 服务IP
    /// </summary>
    public string ServiceIP { get; set; }

    /// <summary>
    /// 服务端口号
    /// </summary>
    public int ServicePort { get; set; }

    /// <summary>
    /// 服务发现IP
    /// </summary>
    public string ConsulIP { get; set; }

    /// <summary>
    /// 服务发现端口号,默认: 8500
    /// </summary>
    public int ConsulPort { get; set; } = 8500;

    /// <summary>
    /// 数据中心名称,默认: xdx
    /// </summary>
    public string DataCenter { get; set; } = "xdx";
}
注册
public void Configure(IApplicationBuilder app, IHostingEnvironment env, IApplicationLifetime lifetime)
{
    // register this service
    app.UseConsul(lifetime, new ServiceEntity
    {
        ServiceName = "MessageService",
        ServiceIP = NetworkHelper.LocalIPAddress,
        ServicePort = 22001,
        ConsulIP = "127.0.0.1",
        ConsulPort = 8500
    });
}
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  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 netcoreapp2.1 is compatible.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.1 569 12/23/2019
1.0.0 847 8/7/2018

新增ServiceEntity属性