NService bus handler and NHibernate errors Options

86 views
Skip to first unread message

Amzath

unread,
Aug 26, 2010, 3:24:56 PM8/26/10
to nhusers
NService bus handler messages are failing due to error in NHibernate.
I am getting the following errors.

System.InvalidOperationException: Internal connection fatal error.
System.ObjectDisposedException: Session is closed!
Object name: 'ISession'.
System.InvalidOperationException: There is already an open DataReader
associated with this Command which must be closed first.
Invalid attempt to call FieldCount when reader is closed.
System.IndexOutOfRangeException: Portfoli1_24_0_


My Scenario is
NService bus message handler in a WCF service
WCF Service bus is running in F5 - networks LTM
But when not running in Cluster, we are not getting this error.
Not able to reprodue in my local
NHibernate version 2.1.2.4000
using Castle NHibernate Facility
Not using MSDTC in Handler, Transaction scope was set to suppress.

My Code looks like this
using (var tx = new TransactionScope(TransactionScopeOption.Suppress))
using (var session = _sessionManager.OpenSession(DatabaseAli))
{
//do some operations
_repository.Store(object1);
_repository.Insert(object2);
_repository.Delete(object2);
tx.Complete()
}



Can any one help on this?

John Davidson

unread,
Aug 26, 2010, 4:43:25 PM8/26/10
to nhu...@googlegroups.com
First, TransactionScope is not a replacement for the required NHibernate transaction. That issues has been discussed a number of times in the last week or so. 

John Davidson


--
You received this message because you are subscribed to the Google Groups "nhusers" group.
To post to this group, send email to nhu...@googlegroups.com.
To unsubscribe from this group, send email to nhusers+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/nhusers?hl=en.


Amzath

unread,
Aug 27, 2010, 12:43:26 PM8/27/10
to nhusers
You mean Do I have to use Session.BeginTransaction() to mange the
transaction.
> > nhusers+u...@googlegroups.com<nhusers%2Bunsu...@googlegroups.com­>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/nhusers?hl=en.- Hide quoted text -
>
> - Show quoted text -

John Davidson

unread,
Aug 27, 2010, 2:29:53 PM8/27/10
to nhu...@googlegroups.com
Yes

John Davidson

To unsubscribe from this group, send email to nhusers+u...@googlegroups.com.

Amzath

unread,
Aug 31, 2010, 2:12:59 PM8/31/10
to nhusers
Hi John,
Thank you for the answer. I did changed my code to use NHibernate
transaction. But still getting the error. One more information, I am
able to reproduce the error in local machine. Please give me insight
on this
> > <nhusers%2Bunsu...@googlegroups.com<nhusers%252Bunsubscribe@googlegroup­s.com>
> > ­>
> > > > .
> > > > For more options, visit this group at
> > > >http://groups.google.com/group/nhusers?hl=en.-Hide quoted text -

John Davidson

unread,
Aug 31, 2010, 2:28:04 PM8/31/10
to nhu...@googlegroups.com
So now that you have made a change, can we please see the relevant code? Also have you changed FlushMode?

John Davidson

To unsubscribe from this group, send email to nhusers+u...@googlegroups.com.

Amzath

unread,
Sep 1, 2010, 1:24:39 PM9/1/10
to nhusers
Hi John,
I am sorry about having another thread. After I have changed the code,
getting an Object Disposed expcetion. I have created another thread
for that please check here below
http://groups.google.com/group/nhusers/browse_thread/thread/d1a3bc4b46c98f5/2feb9ec95c0606bf?hl=en#2feb9ec95c0606bf.
> > > > <nhusers%2Bunsu...@googlegroups.com<nhusers%252Bunsubscribe@googlegroup­s.com>
> > <nhusers%252Bunsubscribe@googlegroup­s.com>
> > > > ­>
> > > > > > .
> > > > > > For more options, visit this group at
> > > > > >http://groups.google.com/group/nhusers?hl=en.-Hidequoted text -
Reply all
Reply to author
Forward
0 new messages