The inner exception: System.Net.Sockets.SocketException (0x80004005): A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
Background: This error comes from a webservice being called. When Visual Studio is run locally it works without a hitch. When I deploy this application out to a server, hitting the same webservice, I get this error.
What I have tried: Creating the URI from c# library rather than a using a string. Nulling out the proxy property of my WebClient object. Adding an entry in my web.config file for bypass some proxy stuff.
Relevant code:
try
{
var uri = ConfigurationManager.AppSettings["MyUrl"] + "apiAction";
using (var httpClient = new WebClient())
{
httpClient.BaseAddress = uri;
httpClient.Headers.Add("content-type", "application/json; charset=utf-8");
var content = new
{
UserAuthorizationToken = userToken
};
var jsonObj = JsonConvert.SerializeObject(content);
var response = httpClient.UploadString(uri, jsonObj);
}
}
Could anyone point me in the right direction to figuring this out? Thanks in advance
Edit (to prevent having to dig in comments):
The URL is verified to be correct. There are angular functions that are successfully accessing this same method in other places in the application. So, I think that there shouldn't be a firewall issue but I am sort of lost at the moment so I cannot confidently say that there isn't. I can also remote into this server