Have you referenced SessionScopeWebModule on your webconfig file? If so try removing it.
On Aug 12, 4:09 am, Miki Watts <[email protected]> wrote: > I have an asp.net application, and i'm using the pattern i've seen in > a few other places of starting a sessionscope in global.asax: > > Code: > > public Global() > { > this.BeginRequest += new EventHandler(OnBeginRequest); > this.EndRequest += new EventHandler(OnEndRequest); > } > > private void OnEndRequest(object sender, EventArgs e) > { > try > { > SessionScope scope = HttpContext.Current.Items > ["nh.sessionscope"] as SessionScope; > if (scope != null) > { > scope.Dispose(); > } > } > catch (Exception ex) > { > HttpContext.Current.Trace.Warn("Error", "EndRequest: " > + ex.Message, ex); > } > } > > private void OnBeginRequest(object sender, EventArgs e) > { > try > { > HttpContext.Current.Items.Add("nh.sessionscope", new > SessionScope(FlushAction.Never)); > } > } > > protected void Application_Start(object sender, EventArgs e) > { > ActiveRecordInitializer.Initialize > (configuration.ServerConnectionString,configuration.DashBoardConnectionString, > DatabaseTypeEnum.SQL); > } > > I'm getting a ScopeMachineryException "Tried to unregister a scope > that is not the active one" in the dispose section of the > sessionscope. I'm not creating or touching the sessionscope in the > application in any other place. > > I have setup AR in the following way: > > private static Hashtable BuildPropertiesForDatabase > (DatabaseTypeEnum _databaseType, string connectionString) > { > Hashtable connectionProperties = new Hashtable(); > > AddPropertiesByDatabaseType(connectionProperties, > _databaseType); > > connectionProperties.Add("hibernate.connection.provider", > "NHibernate.Connection.DriverConnectionProvider"); > connectionProperties.Add > ("hibernate.connection.connection_string", connectionString); > connectionProperties.Add("hibernate.command_timeout", > 120); > > connectionProperties.Add("isWeb", "true"); > return connectionProperties; > } > > and this config is passed to ActiveRecordStarter.Initialize() > > Any idea what I'm missing ? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Castle Project Users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/castle-project-users?hl=en -~----------~----~----~----~------~----~------~--~---
