3

我在 IIS 上使用默认的“ASP.NET MVC 2 Web 应用程序”(我没有管理员访问权限),虽然我可以导航到

“服务器/ITEC”

如果服务器不返回错误,我无法导航到“服务器/ITEC/About” - 404 错误。

我还在使用 RouteDebugger 进行测试 - 当我使用默认的“服务器/ITEC”时,它匹配(也就是默认的主页/索引控制器操作)但是当我手动输入“服务器/ITEC/About”时,我什至看不到RouteDebugger 页面。另外,值得注意的是,当我在“server/Itec/About”中放置一个“index.html”文件时,它会返回结果,这让我相信该目录配置为使用文件系统,而不是在处理请求时使用 MVC 路由- 这是一个安全的假设吗?

如何更新我的 Global.asax 文件,以便我可以返回非默认控制器/操作?或者这是服务器问题,我该如何解决?

谢谢!

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;

namespace mikeProg
{
    // Note: For instructions on enabling IIS6 or IIS7 classic mode,
    // visit http://go.microsoft.com/?LinkId=9394801

    public class MvcApplication : System.Web.HttpApplication
    {
        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");           

            routes.MapRoute(
                "Default", // Route name
                "{controller}/{action}/{id}", // URL with parameters
                new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults            
            );

            RouteDebug.RouteDebugger.RewriteRoutesForTesting(RouteTable.Routes);

        }

        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();

            RegisterRoutes(RouteTable.Routes);
        }
    }
}
4

1 回答 1

1

我想通了!

在 aspnet_isapi.dll 的通配符应用程序映射部分中,复选框

“验证该文件是否存在”被选中。

一旦我要求系统管理员取消选中它,一切都完美路由。

为什么这甚至是一个选择???我什么时候使用它?

于 2013-02-19T23:35:59.750 回答