我在一个IIS4.0项目(而不是MVC4.0)中配置了ASP.NET 2,但是当我将该项目部署到IIS上时,它会崩溃,并显示以下内容:
System.NullReferenceException: Object reference not set to an instance of an object.
[NullReferenceException: Object reference not set to an instance of an object.]
System.Web.PipelineModuleStepContainer.GetEventCount(RequestNotification notification, Boolean isPostEvent) +30
System.Web.PipelineStepManager.ResumeSteps(Exception error) +1481
System.Web.HttpApplication.BeginProcessRequestNotification(HttpContext context, AsyncCallback cb) +132
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +709我用一个普通的ASP.net网络应用程序再次测试了这一点,并用下面的代码得到了相同的崩溃:
protected override IKernel CreateKernel()
{
return Container;
}
private IKernel Container
{
get
{
IKernel kernel = new StandardKernel(new SiteModule());
var module = new OnePerRequestModule();
module.Init(this);
return kernel;
}
}还有没有其他人让Ninject在ASP.net 4上工作?
更新: 2010.11.03
在做了一些研究之后,它看起来可能与OnePerRequestModule()模块有关,但是删除它似乎并没有解决我在this question的建议下添加它的问题。
发布于 2010-11-04 02:01:45
在Nexject2中,你使用了Ninject.Web扩展(see the complete set here),并且不像在OnePerRequestModule中那样进行任何显式的配置。
你也不会做任何web.config的事情(我用的是the MVC one,而你没有)
https://stackoverflow.com/questions/4089192
复制相似问题