NHibernate和自动递增ID死锁

NHibernate和自动递增ID死锁,nhibernate,Nhibernate,我一直在使用SharpArchitecture和NHibernate来构建我的网站,它可以有很多用户。我的表在数据库设置中使用主键作为标识(1,1)进行设置。最近几天,我注意到在日志文件的基础上出现了一系列死锁问题: System.Data.SqlClient.SqlException: Transaction (Process ID 55) was deadlocked on lock resources with another process and has been chosen as

我一直在使用SharpArchitecture和NHibernate来构建我的网站,它可以有很多用户。我的表在数据库设置中使用主键作为标识(1,1)进行设置。最近几天,我注意到在日志文件的基础上出现了一系列死锁问题:

System.Data.SqlClient.SqlException: Transaction (Process ID 55) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction.
我有时会遇到这样的错误,这可能与:

System.Data.SqlClient.SqlException: Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding.
在我的web.config中,我包含了这一行来设置db隔离属性:

<property name="connection.isolation">ReadUncommitted</property>
ReadUncommitted
根据我在搜索中发现的情况,自动递增的ID正在锁定表,即使我已重新提交未提交。也就是说:

  • 我的结论正确吗
  • 如果是这样的话,我假设如果我用HiLo或GuidComb之类的东西生成ID,它会解决这个问题吗
谢谢大家!

  • 可能是的
对于许多用户,HiLo还可以减少数据库的流量和负载,因此切换到HiLo还是不错的