I have a program, which makes a Post request. This project worked perfectly, but with old versions of .NETCORE (1.1) , I've upgraded everything including the framework to 2.1 . Didn't change the code what so ever, no error occurs and it seemed as the change is ok .
Now my Post request is failing (I'll attach only one, but I have about 4 Post requests, everyone of them fails for the same reason)
EDIT: I've just tested my Get requests as well, the produce the same error ..
This is my code :
using (var client = new HttpClient())
{
Field fld = new Field()
{
...
};
ForJSON bodyFormat = new ForJSON()
{
...
};
string output = JsonConvert.SerializeObject(bodyFormat);
StringContent sc = new StringContent(output, Encoding.UTF8, "application/json");
try
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic",
Convert.ToBase64String(
Encoding.ASCII.GetBytes(
string.Format("{0}:{1}", "XX", "YY"))));
response = await client.PostAsync("https:...", sc); // It fails here
The error message is :
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
I've tried googling this error , but every post doesn't seems relavent to me.. They're talking about permissions firewalls and ports, but why would it work in one project and in the other wouldn’t ?
If I try via Postman / my backup of the the project with 1.1 version , then it works .
Why is this happening ? What got broken? Is there maybe a timeout attribute I need to add?