English 中文(简体)
这404条似乎不可避免——我是错了吗? [Ninject 2.0 with ASP.NET MVC 2 on .NET 4]
原标题:This 404 seems unavoidable - what am I doing wrong? [Ninject 2.0 with ASP.NET MVC 2 on .NET 4]

我下载了较新的Ninject 2.0Ninject.Web.Mvc(目标设计mvc2)来源,并成功地利用4NET(release)。 在试图使用Ninject 2.0提出申请时,我会发现404个错误,我可以说明原因。

这是我的全球大事。

using ...
using Ninject;
using Ninject.Web.Mvc;
using Ninject.Modules;

namespace Booking.Web
{
    public class MvcApplication : NinjectHttpApplication
    {        
        protected override void OnApplicationStarted()
        {
            Booking.Models.AutoMapperBootstrapper.Initialize();
            RegisterAllControllersIn(Assembly.GetExecutingAssembly());
            base.OnApplicationStarted();
        }

        protected void RegisterRoutes(RouteCollection routes)
        {
            ...
            routes.MapRoute(
                "Default",
                "{controller}/{action}/{id}",
                new { controller = "Entry", action = "Index", id = "" }
            );    
        }

        protected override IKernel CreateKernel()
        {
            INinjectModule[] mods = new INinjectModule[] {...};
            return new StandardKernel(mods);
        }
    }
}

<代码>EntryController现存,并有一个Index 方法,简单地说是return View(。 我已经脱节,并核实了<代码>Register AllControllersIn(的电话已经执行。 我还努力使用。 Phil Haacks Routing debugger,但我仍然收到404份。

www.un.org/Depts/DGACM/index_spanish.htm 我为找到这一事业做了些什么?

最佳回答

贵国的道路是否得到登记? 难道这是从基类中呼吁的吗?

还确保你登记控制人员properly。 我不敢肯定Ninject的制片厂是如何期望的,但可能需要一个具体的名称或东西。

问题回答

暂无回答




相关问题
Developing Azure .Net 4.0 Applications

Presently .Net 4.0 is not supported on Azure. This thread indicates that you will not be able to use .Net 4.0 with VS 2010 until it is supported in the cloud. http://social.msdn.microsoft.com I d ...

Entity Framework error when submitting empty fields

VS 2010 Beta 2, .NET 4. In my ASP.NET MVC 2 application, when I submit a form to an action method that accepts an object created by the entity framework, I get the following error: Exception Details:...

log4net with .NET 4.0

I ve thrown together some code to tinker with the new .Net 4.0/VS 2010 pieces, but I can t seem to find a build of my logging framework of choice (log4net) for 4.0, and I m getting reference errors ...

MembershipProvider in .NET 4.0

How can I add the MembershipProvider class to my .NET 4.0 project in VS 2010 B2? I want to customize a MembershipProvider, but I cannot without adding this class. Please guide me through this process....

.NET 4.0 on Windows Azure?

My google-fu is failing me on this one. As a possible solution to Unit Testing .NET 3.5 projects using MStest in VS2010 (but I ve put this in a seperate question because it s kind of unrelated): Is ...

热门标签