我有一个在 Visual Studio 中工作的 MVC3 应用程序,但是当发布到 Web 服务器时,在请求的 URL 上返回 404:/App/Account/LogOn。问题是我从未创建过帐户控制器或操作 LogOn。我不确定为什么 Account/LogOn 甚至正在加载或如何修复它。谢谢。
我的 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);
}
}