locked
Web Api - httppost - The requested resource does not support http method Get RRS feed

  • Question

  • User985287353 posted

    {"Message":"The requested resource does not support http method 'GET'."}

    I get a "The Requested resource does not support http method 'Get'."  when I move this to my production server running IIS8 but works locally on my development machine.

    I have looked at some of the web.config changes, but they don't seem to make any sense since I am asking to POST and its giving me a GET error.

    Any ideas what I am missing?

    Wednesday, October 4, 2017 11:44 AM

All replies

  • User1120430333 posted

    I get a "The Requested resource does not support http method 'Get'."  when I move this to my production server running IIS8 but works locally on my development machine.

    So what you are saying here is that you never told VS to deploy the Web solution to local IIS so that you could code. test and debug the source code against the  real IIS. You have been developing against IIS Express that is not the real IIS.  

    Maybe, your solution needs the System.Web.Http.AcceptVerbs("GET", "POST")]

    https://www.exceptionnotfound.net/using-http-methods-correctly-in-asp-net-web-api/

    Maybe, you are using the MVC namespace instead of the HTTP namespace for WebApi  for get, put, etc. and etc.

    I have looked at some of the web.config changes, but they don't seem to make any sense since I am asking to POST and its giving me a GET error.

    Maybe IIS the real one is not configured right.

    https://docs.microsoft.com/en-us/iis/get-started/planning-your-iis-architecture/introduction-to-applicationhostconfig

    VS project has the IIS Express config too, the same config file name.

    Wednesday, October 4, 2017 12:53 PM
  • User1168443798 posted

    Hi sandeepkumar,

    >> but they don't seem to make any sense since I am asking to POST and its giving me a GET error.

    Do you mean you got error related with Get request while you sent POST request? Could you share us how did you send request to Web API?

    How did you publish to production server? Is there any middleware which will redirect the request between the client and production server?

    I assume there is a Router Center which will redirect your request, otherwise, I could not think out a reason which will cause Post Request Get Error.

    Best Regards,

    Edward

    Thursday, October 5, 2017 7:17 AM
  • User985287353 posted

    Hi Edward

    thanks for your response the issue was resolved by web.config changes in url in lower case sensitivity remove

    regards 

    sandeep

    Friday, October 6, 2017 3:29 PM
  • User1168443798 posted

    Hi sandeepkumar,

    Thanks for sharing the solution.

    I would suggest you mark your reply as answer which is the way to close a thread here.

    Best Regards,

    Edward

    Monday, October 9, 2017 2:41 AM
  • User-1887068296 posted

    For anybody who comes across this, I also had this issue when I sent the request to http instead of https

    Wednesday, August 8, 2018 5:08 PM