Skip to content Skip to sidebar Skip to footer

Timeout Exception When Timeout Set To Infinite Time

In my C# .NET 3.5 application I am using CastleProject ActiveRecord over NHibernate. This is desktop application using MS SQL Server 2008. I have set ADO command timeout to 0 to pr

Solution 1:

It's correct that a value of 0 indicates no timeout (as defined in the MSDN docs), however while NHibernate's driver passes the config value to the db command when it's >= 0, the batcher's condition checks that the value is > 0.

Therefore, when you set batching on, with a timeout value of 0, the value isn't carried over to the db command so it remains as default.

It's entirely possible that this is by design, and that NHibernate developers intentionally disabled disabling timeouts for batch scenarios. Disabling timeout is a bad idea anyway, if you have troubles with timeout errors I would raise the value, but not disable it.

Please confirm this with NHibernate devs.

Solution 2:

You might be looking to set the timeout for specific queries and not at web.config level (otherwise you really need to tune up your application :) ).

I've recently found this answer that helped me:

How to set Nhibernate LINQ Command Timeout using Session.Query

Post a Comment for "Timeout Exception When Timeout Set To Infinite Time"