通过应用程序设置在ASP.NET Core Azure Web App的web.config中设置requestTimeout [英] Setting requestTimeout in web.config of an ASP.NET Core Azure Web App via Application Settings

查看:162
本文介绍了通过应用程序设置在ASP.NET Core Azure Web App的web.config中设置requestTimeout的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个看起来像这样的web.config,并且已添加为我的解决方案中许多应用程序的链接:

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>

其中一项服务可能会长时间运行单个请求,因此我想增加该服务的IIS请求超时,这可以通过添加到aspNetCore配置中来实现,如下所示:

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"/>

但是,鉴于此web.config是以其他方式共享的,并且我不想更改其他应用程序的行为,因此我想通过我的手臂模板中的应用程序设置进行配置.

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.

当我尝试以下操作时,出现错误消息%REQUEST_TIMEOUT%不是有效时间,并且部署无法启动webapp.

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?

推荐答案

如果使用的是Azure DevOps,则在部署过程中会使用一些选项:

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

    如果您正在使用Azure App Service部署任务,则可以在部署期间启用
  1. "XML变量替换".

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

添加powershell任务以使用管道变量中的值更改请求超时.

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

注意:如果在web.config中将requestTimeout设置为10分钟,则请求将继续运行直至230秒.但是客户端将在230秒后被应用程序服务终止,并且会收到错误消息.

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.

这篇关于通过应用程序设置在ASP.NET Core Azure Web App的web.config中设置requestTimeout的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆