If you're using the SessionScopeWebModule you don't need to handle
session disposal in Global_EndRequest

On Aug 5, 1:01 pm, Joe <[email protected]> wrote:
> Hi,
>
> I have recently started seeing
> Castle.ActiveRecord.Framework.Scopes.ScopeMachineryException errors
> and I am not sure what I might have done to cause this.
>
> ActiveRecord is initialized imy global.asax.vb as follows:
>
>     Sub Application_Start(ByVal sender As Object, ByVal e As
> EventArgs)
>         log4net.Config.XmlConfigurator.Configure()
>         ConfigureActiveRecord()
>         IoC.Initialize(New UnityResolver())
>     End Sub
>
>     Private Sub ConfigureActiveRecord()
>
>         Dim properties As New Hashtable
>         properties.Add("hibernate.connection.driver_class",
> "NHibernate.Driver.SqlClientDriver")
>         properties.Add("hibernate.dialect",
> "NHibernate.Dialect.MsSql2005Dialect")
>         properties.Add("hibernate.connection.provider",
> "NHibernate.Connection.DriverConnectionProvider")
>         properties.Add("hibernate.connection.connection_string",
> ConfigurationManager.ConnectionStrings
> ("MyApplication").ConnectionString)
>
>         Dim source As New InPlaceConfigurationSource
>         Dim asm As Assembly = Assembly.Load("MyApplicationCore")
>         source.Add(GetType(ActiveRecordBase), properties)
>         ActiveRecordStarter.Initialize(asm, source)
>
>     End Sub
>
> And the error occurs here:
>
>     Private Sub Global_EndRequest(ByVal sender As Object, ByVal e As
> System.EventArgs) Handles Me.EndRequest
>         Dim scope As SessionScope = TryCast(HttpContext.Current.Items
> ("ar.sessionscope"), SessionScope)
>
>         If Not scope Is Nothing Then
>             scope.Dispose()
>         End If
>     End Sub
>
> Is there anything in particular I should be looking for?  The error
> seems to happen randomly.  Any pointers or suggestions would be
> greatly appreciated.
>
> Thanks
> Joe
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to