Timeout exception when using NHibernate TransactionScope

五迷三道 提交于 2019-12-10 11:17:57

问题


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 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?


回答1:


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



来源:https://stackoverflow.com/questions/3855315/timeout-exception-when-using-nhibernate-transactionscope

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!