在webAPI2.2中有支持,参考地址:https://docs.microsoft.com/en-us/aspnet/web-api/overview/releases/whats-new-in-aspnet-web-api-22#ARI,具体做法: public class BaseController : ApiController { [Route("{id:int}")] public string Get(int id) { return "Success:&qu…
using System; using System.Collections.Generic; using System.Data; using System.IO; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; namespace WebAPIForAndroid.Controllers { //[Route("api/[controller]")] //默认的路由规则…