1
I am making a request in a URL and trying to get the answer, I get the following error:
The underlying connection was closed: Unexpected error in an upload.
The point is that this instruction worked normally.
Below the code:
var httpWebRequest = WebRequest.Create("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
httpWebRequest.ContentType = "application/json";
httpWebRequest.Method = "POST";
using (var streamWriter = new StreamWriter(httpWebRequest.GetRequestStream()))
{
string json = "{ 'nl': { 'NL': '" + numeroLogico + "', 'CPF_CNPJ': '" + cnpj.Trim() + "', 'Bandeiras': [" + bandeiras + "], 'InativarBandeira': '" + inativarBandeiras + "', 'InativarLogico': '" + inativarLogico + "' } }";
string jsonFinal = json.Replace("'", "\"");
streamWriter.Write(json);
streamWriter.Flush();
streamWriter.Close();
}
var httpResponse = (HttpWebResponse)httpWebRequest.GetResponse();
After the reply request, I get the error. I don’t know what to do, I’ve seen everything and nothing works.
If testing the request elsewhere works normal?
– Jéf Bueno
@LINQ yes. I make the call via Postman for example and it works. this connection worked for months, and stopped without any explanation.
– Thiago Henrique