2013-05-02 58 views
1

我有一個最初在IIS 7.5上開發的ASP.NET MVC4 web應用程序。 RouteConfig:iis8上的asp.net mvc4默認控制器

routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); 

AreaRegistration.RegisterAllAreas(); 

routes.MapRoute(
    name: "Default", 
    url: "{controller}/{action}/{id}", 
    defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional } 
); 

AdminAreaRegistration:

context.MapRoute(
    name: "Admin", 
    url: "Admin/{controller}/{action}/{id}", 
    defaults: new { controller = "AdminIndex", action = "Index", id = UrlParameter.Optional }, 
    namespaces: new[] { "Web.Areas.Admin.Controllers" } 
); 

在IIS 7.5中的一切工作正常。在部署到IIS 8 url/Admin /返回錯誤403之後。但是,如果指定了控制器名稱,它將起作用:/ Admin/AdminIndex /。有任何想法嗎?提前致謝。

+0

作爲一個臨時解決方案更新的web.config用: <添加URL = 「〜/系統管理員」 mappedUrl = 「〜/管理/ AdminIndex」/> 它現在工作。 – SergB 2013-05-03 10:08:25

回答

0

嘗試改變路線的順序。

+0

全部保持不變:IIS 7.5工作,IIS 8不工作。 – SergB 2013-05-02 14:59:01