Hosting MVC2 on IIS6

自闭症网瘾萝莉.ら 提交于 2019-12-07 05:37:33

问题


I need a little help. I'm trying to host an MVC 2 application on IIS6. On my dev machine (XP) it runs perfectly in Cassini or as web site in IIS.

First i tried to reference the .mvc extension to aspnet_isapi but when that didn't work i went with the aspx extension instead.

Any ideas? I've probably missed something obvious.

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

            AreaRegistration.RegisterAllAreas();

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

        protected void Application_Start()
        {
            RegisterRoutes(RouteTable.Routes);
        }
    }

EDIT:

Had some bad references that i cleaned out and is now stuck with this on my master page:


回答1:


I think you should try this: http://haacked.com/archive/2008/11/26/asp.net-mvc-on-iis-6-walkthrough.aspx




回答2:


Does your .aspx mapping in IIS (or your failed .mvc mapping) have the "check that file exists" option ticked?

That's the most obvious first place it can fail. Also, when the .mvc mapping failed, was it the same error or different (realise that this latter sentence may have been better as a comment...)



来源:https://stackoverflow.com/questions/2160838/hosting-mvc2-on-iis6

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!