Skip to content

MrAnderson1989/ServiceRegister

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 

Repository files navigation

ServiceRegister

Consul 服务注册/发现组件。

doc

配置文件

"Service": {
    "Name": "OrgSvc",  
    "IP": "10.1.75.52", 
    "Port": "80"
  },
  "Consul": {
    "IP": "10.1.75.52",
    "Port": "8500"
  }

Startup.cs 添加代码


 app.UseHealthMiddleware();

ConsulService consulService = new ConsulService()
{
    IP = Configuration["Consul:IP"],
    Port = Convert.ToInt32(Configuration["Consul:Port"])
};

HealthService healthService = new HealthService()
{
    IP = Configuration["Service:IP"],
    Port = Convert.ToInt32(Configuration["Service:Port"]),
    Name = Configuration["Service:Name"],
};

app.RegisterConsul(lifetime, healthService, consulService);

About

服务注册组件

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published