I have an MVC3 application that works in Visual Studio, but when published to the web server returns a 404 on Requested URL: /App/Account/LogOn. The problem is I never created an Account controller or the action LogOn. I'm not sure why Account/LogOn is even loading or how to fix it. Thanks.

My global.asax.cs file looks like this:

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);
    }
}

没有正确的解决方案

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top