我正在使用Windows Azure Cloud运行网站。有没有办法每隔20分钟ping一次我的网站?我的网站流量很低,我需要阻止网站始终启动和停止应用池。
答案 0 :(得分:1)
您可以设置一个Cron作业来执行ping操作,查看任务'Scheduling with Windows Azure Web Sites using a Cron Job Service'以获取示例
答案 1 :(得分:1)
如果您正在使用完整的云服务(例如,Web角色),则可以使用启动任务将应用程序池设置为永不关闭。这个脚本以及我认为有用的一些其他IIS配置更改。
@ECHO OFF
@REM A file to flag that this script has already run
@REM because if we run it twice, it errors out and prevents the Azure role from starting properly
@REM %~n0 expands to the name of the currently executing file, without the extension
SET FLAGFILE=c:\%~n0-flag.txt
IF EXIST "%FLAGFILE%" (
ECHO %FLAGFILE% exists, exiting startup script
exit /B
) ELSE (
date /t > %FLAGFILE%
)
@REM Enable IIS compression for application/json MIME type
@REM This will fail the second time you run it on a machine (eg, your desktop). So don't do that.
%windir%\system32\inetsrv\appcmd.exe set config -section:system.webServer/httpCompression /+"dynamicTypes.[mimeType='application/json',enabled='True']" /commit:apphost
%windir%\system32\inetsrv\appcmd.exe set config -section:system.webServer/httpCompression /+"dynamicTypes.[mimeType='application/json; charset=utf-8',enabled='True']" /commit:apphost
@REM Set IIS to automatically start AppPools
%windir%\system32\inetsrv\appcmd.exe set config -section:applicationPools -applicationPoolDefaults.startMode:AlwaysRunning /commit:apphost
@REM Set IIS to not shut down idle AppPools
%windir%\system32\inetsrv\appcmd set config -section:applicationPools -applicationPoolDefaults.processModel.idleTimeout:00:00:00 /commit:apphost
@REM remove IIS response headers
%windir%\system32\inetsrv\appcmd.exe set config /section:httpProtocol /-customHeaders.[name='X-Powered-By']