- install the package
dotnet add package 13angs.Consul.Client --version 0.0.1
- register the service in DI container
var consulConfig = Configuration.GetConsulConfig();
builder.Services.RegisterConsulServices(consulConfig);
- update the appsetting.json
{
"ConsulConfig": {
"ServiceDiscoveryAddress": "http://dcc-consul-server1:8500",
"ServiceAddress": "http://localhost:5117",
"ServiceName": "dcc-sample",
"ServiceId": "v1"
}
}
- Done!.