简体   繁体   English

Azure Web Apps中的调用应用程序初始化模块

[英]Call App Initialization module in Azure Web Apps

I have an ASP .NET MVC 5 app in which I defined an initialization page in my web.config : 我有一个ASP .NET MVC 5应用程序,在其中我在web.config定义了一个初始化页面:

<applicationInitialization>
    <add initializationPage="/Cache/Index" />
</applicationInitialization>

This action generates the cache for the entire website but right now it is never called. 此操作将为整个网站生成缓存,但是现在永远不会调用它。

I would like this page to be called right after the deployment on the staging slot but not when I swap from stage to production. 我希望在登台插槽上部署后立即调用此页面,但当我从舞台切换到生产时不希望调用此页面。

How can I achieve that ? 我该如何实现?

Thanks. 谢谢。

would like this page to be called right after the deployment on the staging slot but not when I swap from stage to production. 希望在暂存槽中部署后立即调用此页面,但当我从舞台切换到生产时不希望调用此页面。

As we know, the Application Initialization Module will help warm up the application during the swap operation. 众所周知,应用程序初始化模块将在交换操作期间帮助预热应用程序。 If you'd like to let staging slot warm up without swapping from staging to production, you could try to create a dev slot and enable Auto Swap , and then you could publish application to dev slot, which will auto swap from dev to staging and make application warm up. 如果您想让暂存插槽预热而不将暂存插槽切换到生产环境,则可以尝试创建一个dev插槽并启用Auto Swap ,然后可以将应用程序发布到dev插槽,这将自动从dev切换到暂存和使应用程序热身。

Create dev and staging slots 创建开发和暂存槽

在此处输入图片说明

Enable Auto Swap for dev slot 为开发版位启用自动交换

在此处输入图片说明

Configures AppInit module 配置AppInit模块

<system.webServer>
  <applicationInitialization>
    <add initializationPage="/Cache/Index.aspx" hostName="specify the host name to use for the warm up requests here" />
  </applicationInitialization>
</system.webServer>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM