Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Windows Azure Startup task not firing

I have a standard ASP.Net application to which I added an Azure Deployment project to deploy to Azure. The app deploys fine to Azure.

I then wanted to extend it to have a startup task.

I added the following to the ServiceDefintion.csdef

<Startup>
  <Task commandLine="startup.cmd" executionContext="elevated" taskType="simple"/>
</Startup>

startup.cmd is located in the applications bin folder. I have logging the command file so I can see it is not being executed.

When I deploy the same application to the Compute Emulator on my local machine the startup task executes correctly.

Am I missing something?

like image 481
keitn Avatar asked Nov 13 '22 10:11

keitn


1 Answers

Your "startup.cmd" shall not just be in your app BIN folder, but instead in the root folder and marked as "Content" and "Copy to output directory" -> "Copy always". Otherwise it will not get deployed to the Azure.

Another moment to pay attention with Web Applications is that you most probably shall put the bin folder also in the startup task definition. Something like:

<Startup> 
  <Task commandLine="./bin/startup.cmd" executionContext="elevated" taskType="simple"/> 
</Startup> 

Hope this helps.

like image 117
astaykov Avatar answered Dec 11 '22 11:12

astaykov