2011-09-14 3 views
1

Visual Studio에서 작동하는 MVC3 응용 프로그램이 있지만 웹 서버에 게시하면 요청 된 URL :/App/Account/LogOn에 404가 반환됩니다. 문제는 계정 컨트롤러 또는 LogOn 작업을 만들지 않은 것입니다. Account/LogOn이로드되는 이유 또는 해결 방법이 확실하지 않습니다. 감사.404 with ASP.net MVC3 및 ninject.web.mvc

내 global.asax.cs 파일은 다음과 같다 :

public class MvcApplication : NinjectHttpApplication 
{ 
    public static void RegisterGlobalFilters(GlobalFilterCollection filters) 
    { 
     //filters.Add(new HandleErrorAttribute()); 
    } 

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

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

    } 

    // Create ninject kernel 
    protected override IKernel CreateKernel() 
    { 
     var kernel = new StandardKernel(); 
     // Add bindings 
     kernel.Bind<IEmployeeRepository>().To<EFEmployeeRepository>(); 
     kernel.Bind<IDocumentRepository>().To<DocumentRepository>(); 
     // Load kernel 
     kernel.Load(Assembly.GetExecutingAssembly()); 
     return kernel; 
    } 

    // Replaces App_Start() when using Ninject 
    protected override void OnApplicationStarted() 
    { 
     base.OnApplicationStarted(); 
     AreaRegistration.RegisterAllAreas(); 
     RegisterGlobalFilters(GlobalFilters.Filters); 
     RegisterRoutes(RouteTable.Routes); 
    } 
} 

답변

1

내 추측이 새로운 MVC를 만들 때이 기본 로그인 페이지이므로이, 당신의 Web.config에서 오는 것일 것 계획. [Authorize] 속성이 적용된 작업을 실행하려고 할 때 리디렉션되는 위치입니다. 당신은 당신이 보안을 사용하지 않는 경우, 그렇지 않으면, 여기에 URL에서 필요 자신의 로그인 페이지가있는 경우

<authentication mode="Forms"> 
     <forms loginUrl="~/Account/LogOn" timeout="2880" /> 
    </authentication> 

, 다음을 수행 행동에 대한 확인 :라는 섹션

확인 [Authorize] 속성

+0

Doh! - 고마워. =) – decompiled