ShuaiSister 发表于 2024-3-11 09:21:40

Failed to load resource: the server responded with a status of 500 (Internal ...

我有一份用表格做的报表,要求是一开打就运行所有数据,数据来源于外部的SQLserver的数据库,在数据库中运行48秒就可以将数据全部运行出来,但是在活字格中运行时,会报错:Failed to load resource: the server responded with a status of 500 (Internal Server Error),而且界面一直处于在运行中状态,但是如果我输入条件查询立刻就能查询出数据,请问这是什么原因,烦请帮忙解决下,具体请见附件。


ShuaiSister 发表于 2024-3-11 09:21:41

ShuaiSister 发表于 2024-3-12 09:22
我们有专属客服,只是他出差去了不方便远程,你们可否找个专家帮忙远程解决下?
我找到解决办法了,我把视图改成用存储过程,虽然运行时也超过了30s,但是数据能运行出来且不报错。

Grayson.Shang 发表于 2024-3-11 12:16:56

大佬您好,是这样子的,SQL Server连接的时候,这个有一个执行命令超时时间,这个时间设置的是30s超时,咱们这个命令执行之间因为超过了30s,所以在活字格中执行本身就会报错,咱们看是否可以先将SQL优化一下,能不能优化到30s以内。

小年糕 发表于 2024-3-11 13:51:46

能不能把那个报错信息截个全图?你那边给表格放一个分页导航按钮单元格,运行之后看看能出来数据吗?



ShuaiSister 发表于 2024-3-11 14:17:58

Grayson.Shang 发表于 2024-3-11 12:16
大佬您好,是这样子的,SQL Server连接的时候,这个有一个执行命令超时时间,这个时间设置的是30s超时,咱 ...

   这份报表有很多计算逻辑在里面,优化过了也需要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

ShuaiSister 发表于 2024-3-11 14:21:05

小年糕 发表于 2024-3-11 13:51
能不能把那个报错信息截个全图?你那边给表格放一个分页导航按钮单元格,运行之后看看能出来数据吗?




我试了分页虽然可以,但是点击下一页时会重新加载很慢,导出Excel还报错。

小年糕 发表于 2024-3-11 16:28:19

ShuaiSister 发表于 2024-3-11 14:21
我试了分页虽然可以,但是点击下一页时会重新加载很慢,导出Excel还报错。

确实是超时了,超过30s。你那个Sql那么复杂的话,查询一次都需要30s以上的话,页面上显示,这个速度你的用户能接受吗?
找活字格技术支持吧,感觉需要看看你的Sql,看看能不能提升下性能,也许加个索引就好了。

Nathan.guo 发表于 2024-3-11 18:02:49

大佬,这个问题就像楼上说的:
1.通过索引继续优化sql
2.通过webapi来实现这个功能,在webapi中我们自己链接数据库并获取数据

或者大佬您也可以先填一下我们这边的1V1申请:https://www.grapecity.com.cn/applyonline,
通过申请后会有专门的人联系您,给您提供一个月免费的快速支持通道:loveliness:

ShuaiSister 发表于 2024-3-12 09:22:43

Nathan.guo 发表于 2024-3-11 18:02
大佬,这个问题就像楼上说的:
1.通过索引继续优化sql
2.通过webapi来实现这个功能,在webapi中我们自己 ...

我们有专属客服,只是他出差去了不方便远程,你们可否找个专家帮忙远程解决下?

Nathan.guo 发表于 2024-3-12 18:07:52

ShuaiSister 发表于 2024-3-12 15:56
我找到解决办法了,我把视图改成用存储过程,虽然运行时也超过了30s,但是数据能运行出来且不报错。

问题解决就好,顺便给咱同步下,如果咱们团队有金牌账号的话,尽量使用金牌账号发帖哦~~
这样也方便我们联系到大佬:lol
页: [1] 2
查看完整版本: Failed to load resource: the server responded with a status of 500 (Internal ...