route.MapPageRoute在服务器中不起作用

时间:2019-06-21 17:11:23

标签: c# asp.net iis routes

我正在用Asp.Net URL做一个项目,为此,我在Global.asax.cs文件中使用routes.MapPageRoute(...)。 这对我来说在Localhost中是完美的,但是在服务器中它不起作用,我得到了错误:

404-找不到文件或目录。 您要查找的资源可能已被删除,名称已更改或暂时不可用。

在配置中,我有:

<system.webServer>
    <modules runAllManagedModulesForAllRequests = "true">
        <remove name = "UrlRoutingModule-4.0" />
        <add name = "UrlRoutingModule-4.0" type = "System.Web.Routing.UrlRoutingModule" preCondition = "" />
        <remove name = "Session" />
        <add name = "Session" type = "System.Web.SessionState.SessionStateModule" preCondition = "" />
    </ modules>
    <handlers>
        <add name = "UrlRoutingHandler"
       preCondition = "integratedMode"
       verb = "*"
       path = "UrlRouting.axd"
       type = "System.Web.HttpForbiddenHandler, System.Web, Version = 2.0.0.0, Culture = neutral, PublicKeyToken = b03f5f7f11d50a3a" />
    </ handlers>
</system.webServer>

什么会让我失望?

谢谢。

0 个答案:

没有答案