ASP.NET Web Api Routing Customization

前端 未结 4 1670
刺人心
刺人心 2021-02-19 11:38

I have WebApi controllers that end with the \"Api\" suffix in their names (For ex: StudentsApiController, InstructorsApiController). I do this to easily differentiate my MVC con

4条回答
  •  野的像风
    2021-02-19 12:24

    I think the extensibility point you're looking for is the controller selector. You can create a class that derives from DefaultHttpControllerSelector and overrides the GetControllerName to strip out the "api" part. You can then register this controller selector on your service's configuration Services.

提交回复
热议问题