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?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With