protected void Application_Start() { AreaRegistration.RegisterAllAreas(); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); ModelBinders.Binders.Add(typeof(UserLoadParams), new UserLoadParamsBinder()); InitIoC(); SessionFactoryProvider.InitConfig(ConfigurationManager.AppSettings.Get("ConnectionString")); Container.Register(Component.For <ISession>() .UsingFactoryMethod(() => SessionFactoryProvider.SessionFactory.OpenSession()) .LifestylePerWebRequest()); }