【发布时间】:2019-02-15 22:10:15
【问题描述】:
我在 localhost 中使用过这个路由,它工作正常:
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Authentication", action = "Login", id = UrlParameter.Optional }
);
但是当我部署到具有这种结构的服务器时:
servername/folder/Controller/Action
样式和页面出现 404 错误。
我想动态更改本地主机和服务器之间的路由
【问题讨论】:
-
你的文件夹结构在 localhost 上是什么样子的?它在服务器上是什么样子的?
-
结构相同。我刚刚使用这个 estructure servername/Controller/Action 在同一台服务器上部署了解决方案,它工作正常。但我必须使用这个:servername/folder/Controller/Action。
-
然后在 localhost 上镜像该文件夹结构。
标签: c# asp.net-mvc-5 routing