netcore webapi 设置路由教程

时间:2024-10-12 05:47:57

1、在配置前我们先来看看接口的前缀吧

netcore webapi 设置路由教程

3、我们酋篚靶高需要用到IApplicationModelConvention 这个接口,它是位于Microsoft.AspNetCore.Mvc.ApplicationModels 命令空间下面。

netcore webapi 设置路由教程

5、先定义一个类,用来实现IApplicationModelConvention 接口。

netcore webapi 设置路由教程netcore webapi 设置路由教程

7、在startup.cs 里面ConfigureServices 方法添加配置信息

netcore webapi 设置路由教程

9、把原先的路由前缀去除

netcore webapi 设置路由教程
© 2025 长短途
信息来自网络 所有数据仅供参考
有疑问请联系站长 site.kefu@gmail.com