The remote server returned an error: (500) Internal Server Error. RRS feed

  • Question

  • User1624600859 posted

    Hi all,

    I am calling a PUT method but getting the 500 error. For post the same is working fine.

    Please tell if there is any other property that needs to be set here.

    Requesting Method

    public async Task<HttpResponseMessage> ProcessOutboundRequest()

    byte[] data = encoding.GetBytes(bodyContent.ToString());
    request.Method = "PUT";
    request.ContentLength = data.Length;
    Stream requestStream = request.GetRequestStream();
    requestStream.Write(data, 0, data.Length);

    HttpWebResponse response = (HttpWebResponse)request.GetResponse();// error here (he remote server returned an error: (500) Internal Server Error.)
    if (response != null)
    message.StatusCode = response.StatusCode;
    message.ReasonPhrase = response.StatusDescription;
    return message;



    Method receiving response and reverting the response back to the above method

    public async Task<HttpResponseMessage> TestRequestCustomerNoPut()
    HttpResponseMessage message = new HttpResponseMessage(System.Net.HttpStatusCode.Accepted);
    message = await LogRequest(Request);

    return message;

    For [HttpPost] its working fine. For Put gives error.

    Please tell if there is any other property that needs to be sethere.

    Thanks in advance

    Friday, December 2, 2016 12:48 PM

All replies

  • User-2057865890 posted

    Hi Ronnyrunatserver,

    If you need a particular action to support more than one HTTP method, you can use the [AcceptVerbs] attribute:

    [AcceptVerbs("POST", "PUT")]

    Best Regards,


    Monday, December 5, 2016 5:15 AM
  • User1624600859 posted

    Hi Chris,

    I tried the same but no success

    Tuesday, December 6, 2016 4:40 AM
  • User753101303 posted


    http 500 is a server side error. Have you tried the Windows event log for example to see what is the exact error?

    Tuesday, December 6, 2016 8:42 AM