All ASP.NET Web API controllers return 404

前端 未结 19 1643
臣服心动
臣服心动 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<CustomerInvitation> GetInvitations(){
    

    Will execute as expected:

    public List<CustomerInvitation> GetInvitations(){
    
    0 讨论(0)
提交回复
热议问题