简体   繁体   English

Azure启动任务Appcmd配置我的网站

[英]Azure startup task Appcmd to config my site

I have a azure site running, and I want to solve the notorious application pool restart warm up issue. 我有一个蔚蓝的网站正在运行,我想解决臭名昭著的应用程序池重新启动预热的问题。 It seems that MS has release for Application Initialization IIS. 似乎MS已发布了用于应用程序初始化IIS的版本。

So I have to do the following 1. Install Application Initialization 2. Make some configuration changes mentioned in here http://learn.iis.net/page.aspx/1089/iis-80-application-initialization/ 因此,我必须执行以下操作:1.安装应用程序初始化。2.进行此处http://learn.iis.net/page.aspx/1089/iis-80-application-initialization/中提到的一些配置更改。

a) In Application pool section of %WINDIR%\\system32\\inetsrv\\config\\applicationhost.config file a)在%WINDIR%\\ system32 \\ inetsrv \\ config \\ applicationhost.config文件的“应用程序池”部分中

b) In site section of %WINDIR%\\system32\\inetsrv\\config\\applicationhost.config file ... .... b)在%WINDIR%\\ system32 \\ inetsrv \\ config \\ applicationhost.config文件的站点部分中……。

My question is, how to write the Appcmd script to solve 2. b) to add preloadEnabled="true" to the right place, because i need to do 1) find the root site, given that I dont know the sitename, nor the site id. 我的问题是,如何编写Appcmd脚本来解决2。b)将preloadEnabled =“ true”添加到正确的位置,因为我需要做1)找到根站点,因为我不知道站点名称,也不知道网站ID。 2) add the preloadEnabled="true" property to the root site I found in step 2). 2)将preloadEnabled =“ true”属性添加到在步骤2)中找到的根站点。

Coupled with David's answer to reset the idle timeout, you can also prevent the app pools from recycling at all by using the following as a startup task: 结合David的重置空闲超时的答案,您还可以通过将以下内容用作启动任务来防止应用程序池完全回收:

%windir%\system32\inetsrv\appcmd set config -section:applicationPools -applicationPoolDefaults.recycling.periodicRestart.time:00:00:00

You also need to set two other things: startMode and preloadEnabled . 您还需要设置其他两项: startModepreloadEnabled

For startMode , you can add this to the startup task you created for the code above: 对于startMode ,可以将其添加到为上面的代码创建的启动任务中:

%windir%\system32\inetsrv\appcmd set config -section:applicationPools -applicationPoolDefaults.startMode:AlwaysRunning

For preloadEnabled , you can do what Alex said and do this in your startup task: 对于preloadEnabled ,您可以执行Alex所说的,并在启动任务中执行以下操作:

appcmd set app "websitename/vdirname" /preloadEnabled:true

As far as avoiding restart, add this command to your startup script: 为了避免重新启动,请将以下命令添加到启动脚本中:

%windir%\system32\inetsrv\appcmd set config -section:applicationPools -applicationPoolDefaults.processModel.idleTimeout:00:00:00

Not sure about your preload question. 不确定您的预载问题。

There's a sample on http://blogs.msdn.com/b/tom/archive/2011/02/18/installing-and-using-an-httpmodule-in-windows-azure.aspx . http://blogs.msdn.com/b/tom/archive/2011/02/18/installing-and-using-an-httpmodule-in-windows-azure.aspx中有一个示例。 Essentially, you need to set executionContext to elevated, so your web role's entry point (but not ASP.NET application) will run under administrator previlige. 本质上,您需要将executionContext设置为提升,因此您的Web角色的入口点(而不是ASP.NET应用程序)将在管理员权限下运行。 Inside the entry point, you can use IIS administration API to configure the warm up module. 在入口点内部,您可以使用IIS管理API配置预热模块。

If you are looking to configure the site/application pool using an AppCmd startup task, check out my recent post about this: 如果您希望使用AppCmd启动任务配置站点/应用程序池,请查看我最近关于此的文章:

http://mvolo.com/configure-iis-websites-windows-azure-startup-tasks-appcmd/ http://mvolo.com/configure-iis-websites-windows-azure-startup-tasks-appcmd/

This covers how to find the site/application pool to edit, and also how to run the task AFTER the site/apppool configuration is created and not before. 这涵盖了如何查找要编辑的站点/应用程序池,以及如何在创建站点/应用程序池配置之后而不是之前运行任务。

We are actually enabling application warmup via serviceAutoStartProviders using this approach, I will blog about the configuration tool we use / issues we solved in a later post. 我们实际上是使用这种方法通过serviceAutoStartProviders启用应用程序预热的,我将在稍后的博客中博客介绍我们使用的配置工具/解决的问题。

If you need help with that now, send me an email. 如果您现在需要帮助,请给我发送电子邮件。

I know this is an old question but to hopefully answer this part : 我知道这是一个老问题,但希望能回答这一部分:

how to write the Appcmd script to solve 2. b) to add preloadEnabled="true" to the right place, because i need to do 如何编写Appcmd脚本来解决2。b)将preloadEnabled =“ true”添加到正确的位置,因为我需要这样做

Use the appcmd : 使用appcmd

appcmd set app "websitename/vdirname" /preloadEnabled:true

Regards Alex 问候亚历克斯

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

相关问题 为什么appcmd.exe解锁配置无法在Azure模拟器上运行? - Why is appcmd.exe unlock config not working on Azure emulator? appcmd检查配置是否存在? - appcmd to check a config exists? appcmd.exe 覆盖单个站点的整个 xml 配置(将设置应用于已存在的站点) - appcmd.exe to overwrite a single site's entire xml config (applying the settings to a site that already exists) appcmd创建的站点使用iis 7忽略了asp.net web.config文件 - appcmd created site ignoring asp.net web.config file with iis 7 创建 PowerShell 脚本以启用 HTTPCompression 并在 web 站点的配置文件中使用命令行(appcmd)添加 MimeType - Create PowerShell script to enable HTTPCompression and add MimeTypes using command line(appcmd) in a web site's config file 使用appcmd将应用程序池与站点相关联 - Associate an application pool to site with appcmd Azure:如何延迟执行启动任务? - Azure: How to execute a startup task delayed? 如何在Azure Web App框上执行appcmd? - How to execute appcmd on Azure Web App box? 使用appcmd添加新网站而不提供网站ID? - Using appcmd to add a new site without supplying site id? 在Windows Server 2012的Azure启动任务中安装功能 - Installing feature in Azure startup task for Windows Server 2012
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM