MVC3:与目录同名的路由

时间:2013-01-10 11:57:46

标签: asp.net asp.net-mvc asp.net-mvc-3 routes

我将ASP.NET MVC Route URL设置为“/ Services”,指向控制器操作,但是还有一个目录,其中包含名为“Services”的C#Services类,用户无法导航到该类。这导致我的路线出现问题。它会引发以下错误:

HTTP Error 403.14 - Forbidden
The Web server is configured to not list the contents of this directory.

有谁知道如何克服这个问题?

谢谢

1 个答案:

答案 0 :(得分:3)

您可能最好没有这种冲突,但可以通过在RouteCollection上设置RouteExistingFiles属性来禁用该功能。