Hold on. before you mark this as duplicate. I am having a slightly different issue. So I'm calling an api that throws this exception. But - the catch is This happens only when the call is made from server. If i make an angular /ajax call - this works perfectly fine. Where as in .net when I write the following
using (HttpClient hc = new HttpClient())
{
hc.BaseAddress = new Uri(endpoint);
hc.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
HttpResponseMessage response = hc.GetAsync(url).Result;
}
I get the inner exception saying No connection could be made because the target machine actively refused it xx.xxx.xx.xx:pp
I checked all the links Here and here. They all are talking about Firewall / Network issues. I dont feel this is firewall or network because it works via ajax. I am thinking more to do with Server configuration. Any pointers would be helpful.
Also - this works when I make the call from browser or via fiddler.