ASP Core: how to configure area for api controller without AreaAttribute (or how to enable convention area routing for Api controller)?
问题 Razor Pages do not need any AreaAttribute and it is enough to place them into Areas/MyArea/Pages folder and this is enough to enable routing /MyArea/MyPage + My Proj + Areas + MyArea + Pages - MyPage.cshtml But when if I put API Controlller MyApi.cs to MyArea folder: + My Proj + Areas + MyArea + Pages - MyApi.cs then I am become forced to "hardcode" area name [Area("MyArea")] // !!! can't be missed [Route("[area]/api/[action]")] [Produces("application/json")] [ApiController] public class