将ASP.NET MVC NHibernate应用程序部署到IIS7时出错

Gar*_*ary 3 nhibernate asp.net-mvc iis-7

我有一个在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
Run Code Online (Sandbox Code Playgroud)

这是Application_Start

protected void Application_Start()
        {


                ConfigureLogging();


                ComponentRegistrar.RegisterComponents();


                NHibernateSession.InitSqlServer2005(new WebSessionStorage(this), Settings.Default.DefaultConnString);


                CacheManager.InitCaches();

            }
        }
Run Code Online (Sandbox Code Playgroud)

我迟到了这个应用程序,并不知道MVC和NHibernate的最佳实践

Sly*_*Sly 5

您无法在应用程序启动时配置nhibernate.我不知道为什么,但我也有这个问题.

您可以在Init()中初始化它.您也可以在此处查看 http://code.google.com/p/sharp-architecture/source/checkout