[英]502 Error in Web API for large size of data
I am using angular 2 and web API technologies in my application.我在我的应用程序中使用了 angular 2 和 Web API 技术。 I am calling web API service method from angular via $http call.
我正在通过 $http 调用从 angular 调用 Web API 服务方法。
Actually API method is reading data from data base and doing huge logic to transform the data for UI entity class (lot of codes and loops are there, so i won't post those here).实际上 API 方法是从数据库中读取数据并执行大量逻辑来转换 UI 实体类的数据(那里有很多代码和循环,所以我不会在这里发布)。
The problem is I am getting 502 Bad get way error when I am calling the API method.问题是我在调用 API 方法时收到 502 Bad get way 错误。
I found the problem because of it's a performance issue.我发现了这个问题,因为它是一个性能问题。 it's working fine for me when the data size is low.
当数据量很小时,它对我来说很好用。 But if the data size is large, then I am getting this error.
但是如果数据量很大,那么我就会收到这个错误。
Note : I have checked the data base query.注意:我已经检查了数据库查询。 and it's working fine and return the data very fast.
它工作正常并且返回数据非常快。
I have used timer to check the response time of API method我已经使用计时器来检查 API 方法的响应时间
Result of response time as follow :
响应时间结果如下:
if the data size is low : 00.00:898767 (hh:mm:ss)如果数据大小较低:00.00:898767 (hh:mm:ss)
if the data size is huge : 00:06:654389 (hh:mm:ss)如果数据量很大:00:06:654389 (hh:mm:ss)
If the method response time is more than 2 mins, then only I am getting the bad get way error.如果方法响应时间超过 2 分钟,那么只有我遇到了错误的获取方式错误。 otherwise the method executed successfully without any error.
否则方法成功执行,没有任何错误。
I have tried to increase the executionTimeout=9000
in web config.
我试图增加
web config.
的executionTimeout=9000
web config.
I also tried with different seconds in executionTimeout.
我还尝试在
executionTimeout.
使用不同的秒数executionTimeout.
this is my full web config code这是我的完整网络配置代码
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<!--
Configure your application settings in appsettings.json. Learn more at http://go.microsoft.com/fwlink/?LinkId=786380
-->
<system.web>
<authentication mode="Windows"></authentication>
<authorization>
<deny users="?" />
</authorization>
<httpRuntime executionTimeout = "9000" />
</system.web>
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="true" />
</system.webServer>
</configuration>
but still i am unable to solve this problem.
但我仍然无法解决这个问题。 Could you please let me know how can I fix this issue?
你能告诉我如何解决这个问题吗?
I solved this defect by adding requestTimeout="00:10:00"
in <aspNetCore/>
section我通过在
<aspNetCore/>
部分添加requestTimeout="00:10:00"
解决了这个缺陷
<aspNetCore processPath="%LAUNCHER_PATH%" requestTimeout="00:10:00"
arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout"
forwardWindowsAuthToken="true" />
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.