asp.net - A connection attempt failed because the connected party did not properly -- Using HttpClient -
i receiving connection attempt failed web api service when called service asp.net mvc application. if call service browser or mvc application hosted on server, works.
it works if host application in test server or development server.
it doesn't work when host application on server , call service mvc app.
any suggestion. on hosted server blocking connection.
using (var client = new httpclient()) { string baseurlfromconfig = configurationmanager.appsettings["webserviceurl"]; client.baseaddress = new uri(baseurlfromconfig); client.defaultrequestheaders.accept.clear(); client.defaultrequestheaders.accept.add(new mediatypewithqualityheadervalue("application/json")); uri myuri = new uri(baseurlfromconfig + "api/account/confirmemail?e=" + e + "&code=" + code, urikind.absolute); var response = client.getasync(myuri).result; if (response.issuccessstatuscode) { string responsestring = response.content.readasstringasync().result; } }
Comments
Post a Comment