0

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?

  • Have looked at https://stackoverflow.com/questions/32357354/http-post-not-working-in-owin-self-host-web-api and adding FromBody did not help. Results remained the same. – RawPodolski Apr 05 '21 at 19:44
  • 1
    start with error handling on your api side, so can see what the actual error is – Nonik Apr 05 '21 at 19:51
  • Are you using the same client excpet a differnt URL? How are you compiling code on server? You have to have same version of Net on build and deploy machine; or publish and install using setup.exe. – jdweng Apr 05 '21 at 21:06

0 Answers0