ASP.NET MVC为什么我的路由在发布后不起作用?

时间:2022-01-01 11:00:11

i've got the following routeMaps setup for my website. Running and debugging locally works perfectly. I can publish the website to my server (www) but only the root page works (http://www.domain.com). As soon as I specify a controller (http://www.domain.com/Project) it stops working...

我为我的网站设置了以下routeMaps设置。本地运行和调试工作完美。我可以将网站发布到我的服务器(www),但只有根页工作(http://www.domain.com)。一旦我指定一个控制器(http://www.domain.com/Project)它就会停止工作......

What am i doing wrong?

我究竟做错了什么?

Global.asax.vb

' Note: For instructions on enabling IIS6 or IIS7 classic mode, 
' visit http://go.microsoft.com/?LinkId=9394802

Public Class MvcApplication
Inherits System.Web.HttpApplication

Shared Sub RegisterRoutes(ByVal routes As RouteCollection)
    routes.IgnoreRoute("{resource}.axd/{*pathInfo}")

    ' MapRoute takes the following parameters, in order:
    ' (1) Route name
    ' (2) URL with parameters
    ' (3) Parameter defaults

    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

Sub Application_Start()
    Common.LoadEntitySpacesFactory()
    RegisterRoutes(RouteTable.Routes)
End Sub
End Class

2 个解决方案

#1


Are you deploying to an IIS6 server? If so there are some steps you need to take detailed here. If not, can you explain the error a little more - what exactly does "it stops working..." mean?

您正在部署到IIS6服务器吗?如果是这样,您需要在此详细介绍一些步骤。如果没有,你能不能再解释一下这个错误 - 究竟是什么“它停止工作......”是什么意思?

#2


Are you deploying to IIS5? If so follow this.

你正在部署到IIS5?如果是这样,请遵循此

#1


Are you deploying to an IIS6 server? If so there are some steps you need to take detailed here. If not, can you explain the error a little more - what exactly does "it stops working..." mean?

您正在部署到IIS6服务器吗?如果是这样,您需要在此详细介绍一些步骤。如果没有,你能不能再解释一下这个错误 - 究竟是什么“它停止工作......”是什么意思?

#2


Are you deploying to IIS5? If so follow this.

你正在部署到IIS5?如果是这样,请遵循此