0

I have an API that accepts JSON messages, which works perfectly fine when testing on localhost. But on the production server it does not, I get this error message:

RestSharp.RestClient Extensions.d__16`1.MoveNext() --- End of stacktracing from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)

The production server has an IP filter, so only certain IP addresses can access it, but I have tested with Postman from the same server below code runs on and in Postman it works without any issue.

This is the code that calls the API from the server that has access:

public async Task<string> SubmitOrder(Order order)
{
  try
  {
    var request = new RestRequest("SaveWebsiteOrder", Method.Post)
      .AddJsonBody(order)
      .AddHeader("Authorization", ConfigReadSystem.ApiPassword);
    return await _RestClient.PostAsync<string>(request);
  }
  catch(Exception ex)
  {
    return $"{ex.Message}. {ex.StackTrace} {ex.InnerException?.StackTrace}";
  }
}

So catching the exception does not provide a lot of details, how can I get more information to investigate the actual issue?

1 Answers1

0

Found out it was related to SSL, certificate seems to be invalid. Could solve it via this post