public static void ServiceRegister(string serviceName) { var ipAddress = ServiceRegistryExtensions.GetLocalIpAddress(); if (string.IsNullOrWhiteSpace(ipAddress)) { throw new Exception("can't get server ip address."); } ServiceRegistry = new ServiceRegister(IPAddress.Parse(ipAddress)); ServiceRegistry .SetConsul(ConsulClient) .AddHttpHealthCheck("health", 30, 10) .RegisterServiceAsync(serviceName).Wait(); }