All ASP.NET Web API controllers return 404

前端 未结 19 1716
臣服心动
臣服心动 2020-12-08 01:48

I\'m trying to get an API Controller to work inside an ASP.NET MVC 4 web app. However, every request results in a 404 and I\'m stumped. :/

I have th

19条回答
  •  余生分开走
    2020-12-08 02:35

    Similar problem with an embarrassingly simple solution - make sure your API methods are public. Leaving off any method access modifier will return an HTTP 404 too.

    Will return 404:

    List GetInvitations(){
    

    Will execute as expected:

    public List GetInvitations(){
    

提交回复
热议问题