Ram*_*ran 6 c# asp.net web-config asp.net-web-api angular
我在我的应用程序中使用 Angular 2 和 Web API 技术。我正在通过 $http 调用从 Angular 调用 Web API 服务方法。
实际上API方法是从数据库中读取数据并执行大量逻辑来将数据转换为UI实体类(其中有很多代码和循环,所以我不会在这里发布它们)。
问题是当我调用 API 方法时收到 502 Bad get way 错误。
我发现这个问题是因为它是一个性能问题。当数据量较小时,它对我来说工作得很好。但如果数据量很大,那么我会收到此错误。
注意:我已经检查了数据库查询。它工作正常并且返回数据非常快。
我使用计时器来检查API方法的响应时间
响应时间结果如下:
如果数据量较小:00.00:898767 (hh:mm:ss)
如果数据量很大:00:06:654389 (hh:mm:ss)
如果方法响应时间超过 2 分钟,那么只有我收到 bad get way 错误。否则该方法执行成功,没有任何错误。
我尝试过增加executionTimeout=9000
我web config.
也尝试过使用不同的秒数executionTimeout.
这是我完整的网络配置代码
<?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>
Run Code Online (Sandbox Code Playgroud)
但我仍然无法解决这个问题。您能让我知道如何解决这个问题吗?
我通过添加部分解决了requestTimeout="00:10:00"
这个<aspNetCore/>
缺陷
<aspNetCore processPath="%LAUNCHER_PATH%" requestTimeout="00:10:00"
arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout"
forwardWindowsAuthToken="true" />
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
8497 次 |
最近记录: |