rogeralsing/Microphone

Cluster.RegisterService request canceled while waiting for connection

Opened this issue · 0 comments

I am running Consul on Windows in Development mode. However, I have a problem in registering a service.

Code

    class Program
    {
        static void Main(string[] args)
        {
            var options = new ConsulOptions();
            var loggerFactory = new LoggerFactory();
            var logger = loggerFactory.CreateLogger("logger");
            var provider = new ConsulProvider(loggerFactory, Options.Create(options));

            Cluster.RegisterService(new Uri($"http://localhost:5011"), provider, "values", "v1", logger);

            var res = Microphone.Cluster.Client.GetServiceInstances("values");
        
            Console.ReadLine();
        }
    }

public class ValuesController : Controller
{
    public string Get()
    {
        return "WebApi Service";
    }
}

}

Problem:

However after running the app to register the service, and checking the consul

image

This is also the output of http://localhost:8500/v1/agent/checks:

{
    "service:values_localhost_5011": {
        "Node": "hsalman-pc",
        "CheckID": "service:values_localhost_5011",
        "Name": "Service 'values' check",
        "Status": "critical",
        "Notes": "",
        "Output": "Get http://localhost:5011/status: net/http: request canceled while waiting for connection",
        "ServiceID": "values_localhost_5011",
        "ServiceName": "values",
        "CreateIndex": 0,
        "ModifyIndex": 0
    }
}

Why its failing to register?