HTTP Post request failing with Internal server error in OWIN Self-Host web api server

426 Views Asked by At

I have setup some simple APIs on OWIN self host. On starting the server on my local box everything works as expected, but when I deploy the same APIs on production, the POST API starts failing, while the GET works fine.

    [HttpGet, Route("agent/ping")]
    public HttpResponseMessage Ping()
    {
        string message = "Agent ping successfull.";
        return new HttpResponseMessage(HttpStatusCode.OK) { Content = new StringContent(message) };
    }
    
    [HttpPost, Route("agent/poolrequest")]
    public HttpResponseMessage PoolRequest()
    {
        var jsonString = Request.Content.ReadAsStringAsync().Result;
        string message = $"Agent ping successful. {body}";
        return new HttpResponseMessage(HttpStatusCode.OK) { Content = new StringContent(message) };
    }

The stack trace from server only has:

'System.Net.WebException: The remote server returned an error: (500) Internal Server Error. at System.Net.HttpWebRequest.GetResponse()

Tried multiple things but nothing works. How can I debug this further?

0

There are 0 best solutions below