'/'应用程序中的服务器错误。同样的路线

时间:2011-04-12 08:16:56

标签: asp.net-mvc routes server-error

我一直试图解决这个问题,但无法找到问题的答案。我遇到的问题是这个网址:

localhost:343434/Lev/Details/1/4/CON/2

此网址将在'/'应用程序中返回“服务器错误”。我知道我的Action会返回一个带有theese参数的值。

但是,如果我使用相同的路线,但使用其他参数:

localhost:343434/Lev/Details/3/4/FHS/5

它将调用操作并返回结果。 “/'应用程序中的服务器错误”仅在使用“CON”

时出现

出局就是:

The resource cannot be found. 
Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable.  Please review the following URL and make sure that it is spelled correctly. 

Requested URL: /Lev/Details/1/4/CON/2

这是我的路线:

        routes.MapRoute(
                "LevRoute",
                "{controller}/{action}/{id}/{source}/{levtyp}/{Levid2}/{page}/{order}",
                new { controller = "Lev", action = "Details", page =       UrlParameter.Optional, order = UrlParameter.Optional  }

            );

提前感谢您的帮助!

2 个答案:

答案 0 :(得分:2)

通过将此问题添加到我的Web.config中,我找到了解决问题的方法:

<configuration>
   <system.web>
    <httpRuntime relaxedUrlToFileSystemMapping="true"/>
   </system.web>
</configuration>

答案 1 :(得分:0)

您可以使用Route Debugger调试路径