For the last few months, I have been dealing with a strange behavior wrt PRESSERO web site.
The Call to the web site is handled by a CLR based on this source:
public string TEST_Login()
{
string result = null;
TokenRoot TokenObject = null/* TODO Change to default(_) if this is not a reference type */;
try
{
using (WebClient client = new WebClient())
{
byte[] response = client.UploadValues("http://admin.chi.v6.pressero.com/api/Token?Credential", new NameValueCollection()
{
{
"UserName",
"xxxx"
},
{
"Password",
"xxxx"
},
{
"SubscriberId",
"1234"
},
{
"ConsumerID",
"1234"
}
});
result = System.Text.Encoding.UTF8.GetString(response);
} TokenObject = JsonConvert.DeserializeObject<TokenRoot>(result);
}
catch (Exception ex)
{
throw new ApplicationException(string.Format("Function {0} Error {1}", "IN - GetToken", ex.Message));
return TokenObject.Message;
}
return TokenObject.Data;
}
"The underlying connection was closed: An unexpected error occurred on a send"I tried all possible security values but the call to this code (HTTPS) using exec GetToken from the database always fails.
The only workaround, at this point, is to create an .exe file executed using EXEC xp_cmdshell 'GetToken.exe'.
Running out of reasonable explanations and FIX.
Thanks for helping.