我有一个webapp,在本地调试和测试时可以很好地工作。但是,当我将该站点发布到生产服务器时,路由会搞砸。这是因为它作为生产服务器上的子项目运行。ASP.NET MVC如何在应用程序发布为域的子项目时使用路线?
Testing: http://localhost:xxx/ Production: http://remotehost/webapp/
我该如何设置路由?
这是我目前的路由设置(主要是默认设置)。当我访问http://remotehost/webapp/时,服务器显示默认的Controller操作。但是,当我硬编码控制器(http://remotehost/webapp/Project/它不工作...
Shared Sub RegisterRoutes(ByVal routes As RouteCollection)
routes.IgnoreRoute("{resource}.axd/{*pathInfo}")
routes.MapRoute("ProjectsByCategory", "Project/Category/{id}", _
New With {.controller = "Project", .action = "ListByCategory", .id = ""}, _
New With {.id = "^[0-9]+"})
routes.MapRoute(_
"Default", _
"{controller}/{action}/{id}", _
New With {.controller = "Project", .action = "Index", .id = ""} _
)
End Sub
我让应用程序作为虚拟目录运行,而不是应用程序。而且我还需要添加通配符映射来重写网址。谢谢 – Ropstah 2009-05-03 14:03:10