Nhibernate ver。 1,命令超时不起作用

时间:2017-10-03 06:37:09

标签: nhibernate ado.net castle-windsor

我们正在使用Castle Windsor和Nhibernate,我们遇到命令超时问题。基本上这应该是一个直接解决的问题,但不知何故Nhibernate忽略了配置文件中的属性。

这是Nhibernate配置:

<factory id="nhibernate.factory">
            <settings>
                <item key="hibernate.command_timeout">3000</item>
                <item key="hibernate.show_sql">false</item>
                <item key="hibernate.connection.provider">NHibernate.Connection.DriverConnectionProvider</item>
                <item key="hibernate.connection.driver_class">NHibernate.Driver.SqlClientDriver</item>
                <item key="hibernate.connection.connection_string">#{coreDevConnectionString}</item>
                <item key="hibernate.dialect">NHibernate.Dialect.MsSql2000Dialect</item>
                <!--<item key="hibernate.cache.use_query_cache">true</item>-->
            </settings>
            <assemblies>
                <assembly>Midas.Persistence</assembly>
                <assembly>Midas.DbiCore</assembly>
            </assemblies

超时只有30秒。以下是使用的代码示例:

Dim session As ISession = sessionManager.OpenSession()
Dim result As T
result = CType(session.Load(GetType(T), id), T)
session.Close()
setDirty(Of T)(result, False)
Return (result)

我试图设置属性“hibernate.command_timeout”和“command_timeout”以及似乎没有任何工作。

我收到一个Nhibernate.AdoException,其中包含以下错误消息:

超时已过期。操作完成之前经过的超时时间或服务器没有响应。

这是StackTrace: System.Data.SqlClient.SqlException:超时已过期。操作完成之前经过的超时时间或服务器没有响应。位于System.Data.SqlClient.TdsParter.Run的System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)中的System.Data.SqlClient.SqlConnection.OnError(SqlException异常,布尔breakConnection)(RunBehavior runBehavior,SqlCommand cmdHandler,SqlDataReader dataStream) ,System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior,RunBehavior runBehavior,Boolean returnStream,Boolean async)中的System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds,RunBehavior runBehavior,String resetOptionsString)中的BulkCopySimpleResultSet bulkCopyHandler,TdsParserStateObject stateObj) System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior,RunBehavior runBehavior,Boolean returnStream,String method,DbAsyncResult result)at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result,String methodName,Boolean sendToPipe)at System.Data Midas.Persi中的.SqlClient.SqlCommand.ExecuteNonQuery() stence.ScoreInformationMapper.Calculate(Int64 companyID,Int64 ModelID,Boolean ForceRecalculate,String&amp; Midas.BusinessLogic.ScoreInformationController.CalculateScore2017(Int32 companyId,Int32 modelId,Boolean ForceRecalculate,User user,InformationSource informationSource)中的errorMessage,User user,InformationSource informationSource),位于Midas.BusinessLogic.ScoreInformationController.ReCalculateScore(ScoreInformation scoreInformation,User user,InformationSource informationSource,在Midas.BusinessLogic.ScoreInformationController.AnyInformationUpdated(Object modifiedInformation,CompanyId companyId,User user,InformationSource informationSource)的Midas.BusinessLogic.ScoreInformationController.OwnershipInformationUpdated(Object sender,InstancePersistedEventArgs 1 e) at System.EventHandler中的布尔ForceCalculation,Boolean useRaiseEvent} 1.Invoke(Object发件人,TEventArgs e)在Midas.BusinessLogic.OwnershipInformationController.Save(OwnershipInformation实例,用户用户,InformationSource信息源)Midas.Import.RegtidEjerregisterImportController.ProcessRow(DataRow [] sourceRows,用户用户, InformationSource informationSource,IImportMessageBuilder importMessageBuilder)在Midas.Import.ImportManager.ExecuteImport(IRowImportController rowImportController,SourceDataProviderConfig sourceDataProviderConfig,String informationSourceShortName)

1 个答案:

答案 0 :(得分:0)