这份报表有很多计算逻辑在里面,优化过了也需要30s以上,而且随着数据量越来越多,这个运行时间也不好控制的呢,请问还有没有其他的办法可解决?
我用分页的办法可以运行出来,问题是每点击一次下一页就会重新加载一次,非常慢,而且导出Excel会报错,报错信息如附件。
在执行导出操作时,未知的异常出现。请再次尝试。{ "ClassName": "System.AggregateException", "Message": "One or more errors occurred.", "Data": null, "InnerException": { "$type": "System.Data.SqlClient.SqlException, System.Data.SqlClient", "ClassName": "System.Data.SqlClient.SqlException", "Message": "Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.", "Data": { "$type": "System.Collections.ListDictionaryInternal, System.Private.CoreLib", "HelpLink.ProdName": "Microsoft SQL Server", "HelpLink.ProdVer": "12.00.4100", "HelpLink.EvtSrc": "MSSQLServer", "HelpLink.EvtID": "-2", "HelpLink.BaseHelpUrl": "https://go.microsoft.com/fwlink", "HelpLink.LinkId": "20476", "SqlError 1": "System.Data.SqlClient.SqlError: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding." }, "InnerException": { "$type": "System.ComponentModel.Win32Exception, Microsoft.Win32.Primitives", "ClassName": "System.ComponentModel.Win32Exception", "Message": "等待的操作过时。", "Data": null, "InnerException": null, "HelpURL": null, "StackTraceString": null, "RemoteStackTraceString": null, "RemoteStackIndex": 0, "ExceptionMethod": null, "HResult": -2147467259, "Source": null, "WatsonBuckets": null, "NativeErrorCode": 258 }, "HelpURL": null, "StackTraceString": " at System.Data.SqlClient.SqlCommand.<>c.<ExecuteDbDataReaderAsync>b__126_0(Task`1 result) at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke() at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)--- End of stack trace from previous location --- at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)--- End of stack trace from previous location --- at Forguncy.DataSourceBase.FillTableAsync(String commandText, IEnumerable`1 parameters) at ForguncyDataAccess.DataAccess.a(String A_0, String A_1, DataBaseType A_2, DbParameter[] A_3) at ForguncyDataAccess.DataAccess.SelectAsync(List`1 columnBindingInfos, ISqlCondition selectCondition, TopSqlConditionBase topCondition, String tableName, OrderBySqlCondition orderByCondition, OffsetSqlCondition offsetCondition, Boolean useGroupBy) at Forguncy.Server2.ForguncyServerDataAccess.SelectAsync(List`1 columnBindingInfos, ISqlCondition selectCondition, TopSqlConditionBase topCondition, String tableName, OrderBySqlCondition orderByCondition, OffsetSqlCondition offsetCondition, Boolean useGroupBy) at ForguncyDataAccess.DataAccess.GetDetailDataTableAsync(List`1 columnBindingInfos, ISqlCondition sqlCondition, TopSqlConditionBase topCondition, OrderBySqlCondition orderByCondition, List`1 primaryKeys, OffsetSqlCondition offsetCondition, Boolean distinct) at ForguncyDataAccess.DataAccess.<>c__DisplayClass31_0.<<GetDetailDataTable>b__0>d.MoveNext()", "RemoteStackTraceString": null, "RemoteStackIndex": 0, "ExceptionMethod": null, "HResult": -2146232060, "Source": "Core .Net SqlClient Data Provider", "WatsonBuckets": null, "Errors": null, "ClientConnectionId": "711135f3-8e32-4803-9db8-6f9011255f61" }, "HelpURL": null, "StackTraceString": " at Forguncy.Server2.Controllers.b.a9(String A_0, String A_1) at Forguncy.Server2.Controllers.a.a(ListViewInfo A_0, Boolean A_1) at Forguncy.Server2.Controllers.a.e(GcExcelSheetWrapper A_0, List`1 A_1) at Forguncy.Server2.Controllers.a.b(Int32 A_0) at Forguncy.Server2.Controllers.a.c(Int32 A_0) at Forguncy.Server2.Controllers.a.a(Int32 A_0) at Forguncy.Server2.Controllers.a.a(Func`2 A_0) at Forguncy.Server2.Controllers.a.c(Boolean A_0) at Forguncy.Server2.Controllers.a.a(String A_0, List`1 A_1) at Forguncy.Server2.Controllers.HomeController.a(Object A_0)", "RemoteStackTraceString": null, "RemoteStackIndex": 0, "ExceptionMethod": null, "HResult": -2146233088, "Source": "Forguncy.Server2", "WatsonBuckets": null, "InnerExceptions": { "$type": "System.Exception[], System.Private.CoreLib", "$values": [ { "$type": "System.Data.SqlClient.SqlException, System.Data.SqlClient", "ClassName": "System.Data.SqlClient.SqlException", "Message": "Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.", "Data": { "$type": "System.Collections.ListDictionaryInternal, System.Private.CoreLib", "HelpLink.ProdName": "Microsoft SQL Server", "HelpLink.ProdVer": "12.00.4100", "HelpLink.EvtSrc": "MSSQLServer", "HelpLink.EvtID": "-2", "HelpLink.BaseHelpUrl": "https://go.microsoft.com/fwlink", "HelpLink.LinkId": "20476", "SqlError 1": "System.Data.SqlClient.SqlError: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding." }, "InnerException": { "$type": "System.ComponentModel.Win32Exception, Microsoft.Win32.Primitives", "ClassName": "System.ComponentModel.Win32Exception", "Message": "等待的操作过时。", "Data": null, "InnerException": null, "HelpURL": null, "StackTraceString": null, "RemoteStackTraceString": null, "RemoteStackIndex": 0, "ExceptionMethod": null, "HResult": -2147467259, "Source": null, "WatsonBuckets": null, "NativeErrorCode": 258 }, "HelpURL": null, "StackTraceString": " at System.Data.SqlClient.SqlCommand.<>c.<ExecuteDbDataReaderAsync>b__126_0(Task`1 result) at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke() at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)--- End of stack trace from previous location --- at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)--- End of stack trace from previous location --- at Forguncy.DataSourceBase.FillTableAsync(String commandText, IEnumerable`1 parameters) at ForguncyDataAccess.DataAccess.a(String A_0, String A_1, DataBaseType A_2, DbParameter[] A_3) at ForguncyDataAccess.DataAccess.SelectAsync(List`1 columnBindingInfos, ISqlCondition selectCondition, TopSqlConditionBase topCondition, String tableName, OrderBySqlCondition orderByCondition, OffsetSqlCondition offsetCondition, Boolean useGroupBy) at Forguncy.Server2.ForguncyServerDataAccess.SelectAsync(List`1 columnBindingInfos, ISqlCondition selectCondition, TopSqlConditionBase topCondition, String tableName, OrderBySqlCondition orderByCondition, OffsetSqlCondition offsetCondition, Boolean useGroupBy) at ForguncyDataAccess.DataAccess.GetDetailDataTableAsync(List`1 columnBindingInfos, ISqlCondition sqlCondition, TopSqlConditionBase topCondition, OrderBySqlCondition orderByCondition, List`1 primaryKeys, OffsetSqlCondition offsetCondition, Boolean distinct) at ForguncyDataAccess.DataAccess.<>c__DisplayClass31_0.<<GetDetailDataTable>b__0>d.MoveNext()", "RemoteStackTraceString": null, "RemoteStackIndex": 0, "ExceptionMethod": null, "HResult": -2146232060, "Source": "Core .Net SqlClient Data Provider", "WatsonBuckets": null, "Errors": null, "ClientConnectionId": "711135f3-8e32-4803-9db8-6f9011255f61" } ] }}CurrentMethodName: ExportToExcelThread
|