Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/asp.net-mvc/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net mvc 在IIS6上托管asp.net mvc_Asp.net Mvc_Hosting - Fatal编程技术网

Asp.net mvc 在IIS6上托管asp.net mvc

Asp.net mvc 在IIS6上托管asp.net mvc,asp.net-mvc,hosting,Asp.net Mvc,Hosting,我更改了我的global.asax以注册如下路线: 公共类MVC应用程序 Inherits System.Web.HttpApplication Shared Sub RegisterRoutes(ByVal routes As RouteCollection) routes.IgnoreRoute("{resource}.axd/{*pathInfo}") ' MapRoute takes the following parameter

我更改了我的global.asax以注册如下路线: 公共类MVC应用程序

    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( _

            "Default", _

            "{controller}.aspx/{action}/{id}", _

            New With {.controller = "Home", .action = "Index", .id = ""} _

        ) 

        routes.MapRoute( _

            "Root", _

            "", _

            New With {.controller = "Home", .action = "Index", .id = ""} _

        ) 

    End Sub 

    Sub Application_Start()

        RegisterRoutes(RouteTable.Routes)

    End Sub

End Class
一切正常,但根路径(www.mysite.com)不起作用,我收到一个错误,如:“网站拒绝显示此网页HTTP 403”


如何摆脱此问题???

如果添加一个带有以下页面加载代码的Default.aspx页面,它将正常工作:

        public void Page_Load(object sender, System.EventArgs e)
        {
            // Change the current path so that the Routing handler can correctly interpret
            // the request, then restore the original path so that the OutputCache module
            // can correctly process the response (if caching is enabled).

            string originalPath = Request.Path;
            HttpContext.Current.RewritePath(Request.ApplicationPath, false);
            IHttpHandler httpHandler = new MvcHttpHandler();
            httpHandler.ProcessRequest(HttpContext.Current);
            HttpContext.Current.RewritePath(originalPath, false);
        }

虽然Nebakanerer的解决方案适用于站点的根目录,但它不适用于任何建议子文件夹的URL

因此,我没有选择Default.aspx文件选项,而是将基于IIS6的网站中的所有通配符映射到aspnet_isapi.dll。基本上是让ASP.NET处理所有请求

这篇博文解释了这一过程: [