我有一个在 vs.net 开发 Web 服务器中运行的 Asp.Net MVC 应用程序。当我发布到 IIS7 时,出现以下错误。我花了很多时间,仍然没有解决办法!
[NullReferenceException: Object reference not set to an instance of an object.]
System.Web.PipelineStepManager.ResumeSteps(Exception error) +929
System.Web.HttpApplication.BeginProcessRequestNotification(HttpContext context, AsyncCallback cb) +91
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +508
这是Application_Start
protected void Application_Start()
{
ConfigureLogging();
ComponentRegistrar.RegisterComponents();
NHibernateSession.InitSqlServer2005(new WebSessionStorage(this), Settings.Default.DefaultConnString);
CacheManager.InitCaches();
}
}
我来晚了,不知道MVC和NHibernate的最佳实践
最佳答案
您不能在应用程序启动时配置 nhibernate。我不知道为什么,但我也遇到了这个问题。
您可以在 Init() 中对其进行初始化。你也可以看到它在这里完成 http://code.google.com/p/sharp-architecture/source/checkout
关于asp.net-mvc - 将 ASP.NET MVC NHibernate 应用程序部署到 IIS7 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/821934/