Setting requestTimeout in web.config of an ASP.NET Core Azure Web App via Application Settings

我是研究僧i 提交于 2019-12-13 03:17:24

问题


I have a web.config that looks like so, and is added as a link to a number of applications in my solution:

<configuration>
  <!-- For more info to customize the asp.net core module see https://go.microsoft.com/fwlink/?linkid=838655 -->
  <system.webServer>
    <!-- As connection proxy request contains double escape sequence, we need to enable it. background Azure ARM Apis are enabled it.  -->
      <security>
      <requestFiltering allowDoubleEscaping="true" />
    </security>
    <handlers>
      <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified"/>
    </handlers>
    <aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="false" stdoutLogFile="\\?\%home%\LogFiles\stdout"/>
  </system.webServer>
</configuration>

One of the services has potential for long running single requests, and so I want to increase the IIS request timeout for that service, which can be achieved by adding to the aspNetCore configuration like so:

<aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="false" stdoutLogFile="\\?\%home%\LogFiles\stdout" requestTimeout="00:10:00"/>

However, given this web.config is otherwise shared and I don't want to alter the behaviour of my other apps, I'd like configure this via an application setting from my arm templates.

When I attempt something like the following, I get an error that %REQUEST_TIMEOUT% is not a valid time, and deploying fails to startup the webapp.

How can I enable app settings to insert into the request timeout field?


回答1:


Azure App Service doesn't allow increase requestTimeout, the limit is 230 seconds - see Why does my request time out after 230 seconds?.

I would recommend looking at the Polling (link2) - it is the standard REST-pattern to process long running op.

Other resources:

  • How can increase Azure App Service 230 sec request time out
  • Increase azure web app request timeout



回答2:


If you are using Azure DevOps, some options during deployment:

  1. "XML variable substitution" can be enabled during deployment if you are using Azure App Service deploy task.

  2. Add powershell task to change the request timeout with the value from a pipeline variable.

Note: If the requestTimeout is set to say 10 mins in web.config, the request will continue to run to completion even after 230 seconds. But the client will be terminated by the app service at 230 seconds and will receive an error.



来源:https://stackoverflow.com/questions/55522510/setting-requesttimeout-in-web-config-of-an-asp-net-core-azure-web-app-via-applic

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!