我在Azure Cloud Service项目中添加了一个简单的启动任务。该脚本可确保Cloud Service不会在服务器上超时(请参阅link)。当我将任务添加到ServiceDefinition.csdef文件时,我的项目没有运行;它永远挂起并读取"在Microsoft Azure计算模拟器中启动应用程序的角色......"在VS的状态栏中。这是我的ServiceDefinition.csdef:
<?xml version="1.0" encoding="utf-8"?>
<ServiceDefinition name="DryrunCloud" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition" schemaVersion="2015-04.2.6">
<WebRole name="MyCloud" vmsize="Small">
<Startup>
<Task commandLine="Startup.cmd" executionContext="limited" taskType="simple"></Task>
</Startup>
<Sites>
...
Startup.cmd文件(放在web角色项目的bin文件夹中):
REM *** Prevent the IIS app pools from shutting down due to being idle.
%windir%\system32\inetsrv\appcmd set config -section:applicationPools - applicationPoolDefaults.processModel.idleTimeout:00:00:00
REM *** Prevent IIS app pool recycles from recycling on the default schedule of 1740 minutes (29 hours).
%windir%\system32\inetsrv\appcmd set config -section:applicationPools -applicationPoolDefaults.recycling.periodicRestart.time:00:00:00
有什么想法吗?