Timeout exception when using NHibernate TransactionScope
This is continuation of Timeout exception when timeout set to infinite time (and I also see unanswered SqlConnection and TransactionScope Timeout question).
I am using CastleProject 开发者_JAVA百科ActiveRecord over NHibernate, C# 3.5. I have multiple subsequent inserts to a database within TransactionScope. One of them (random, different each time) fails with TimeoutException. Whichever timeout I set in my config file (10 hours), this does not matter. If I do not use transaction scope, it work (but too slow). It seems, NHibernate transaction has default timeout 30 second and is not affected by hibernate.command_timeout value.
Is it correct? How to overcome this?
Have you tried increasing your connection time out value?
Include "Connection Timeout=somehighvalueinsecondshere" in the connection string.
http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlconnection.connectiontimeout.aspx
精彩评论