asp.net核心3.1改变路线
asp.net core 3.1 change route
有没有简单的方法来更改 asp.net 核心 3.1 控制器的路由?
目前我有控制器 PicVideosController
URL: ...\picvideos... 我被要求将 url 修改为 ...\picturesvideos...
我在控制器端添加了一条路由:
[Route("picturesvideos")]
public class PicVideosController : Controller
报错AmbiguousMatchException: The request matched multiple endpoints. Matches: Main.Controllers.PicVideosController.Pay (Main) Main.Controllers.PicVideosController.Completed (Main)
好像还是看原版的url
试试这个:
[Route("picturesvideos/[action]")]
public class PicVideosController : Controller
{
[Route("/")]
[Route("~/picturesvideos")]
[Route("~/picturesvideos/index")]
public IActionResult Index()
....
有没有简单的方法来更改 asp.net 核心 3.1 控制器的路由?
目前我有控制器 PicVideosController
URL: ...\picvideos... 我被要求将 url 修改为 ...\picturesvideos...
我在控制器端添加了一条路由:
[Route("picturesvideos")]
public class PicVideosController : Controller
报错AmbiguousMatchException: The request matched multiple endpoints. Matches: Main.Controllers.PicVideosController.Pay (Main) Main.Controllers.PicVideosController.Completed (Main)
好像还是看原版的url
试试这个:
[Route("picturesvideos/[action]")]
public class PicVideosController : Controller
{
[Route("/")]
[Route("~/picturesvideos")]
[Route("~/picturesvideos/index")]
public IActionResult Index()
....