I'm adding a simple startup task to my Azure Cloud Service project. The script ensures the Cloud Service does not time out on the server (see link). When I add the task to my ServiceDefinition.csdef file, my project doesn't run; it hangs forever and reads "Starting the roles for the application in the Microsoft Azure compute emulator..." in the status bar of VS. Here is my 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>
...
The Startup.cmd file (placed in bin folder of web role project):
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
Any ideas?
This link ultimately helped me. When you create the cmd file in VS, for some reason it doesn't work. You have to create it outside of your solution and then add it to your project.