Developing ASP.NET MVC Web Applications — Question 151
You define a startup task in the ServiceDefinition.csdef file. The task consists of a batch file that runs a Windows PowerShell script. The script places configuration files in local storage for use in a worker role. The worker role needs this information before starting.
The worker role does not start after the startup task runs.
You need to ensure that the worker role starts.
What should you do?
Answer options
- A. Use environment variables based on members of the RoleEnvironment class instead of static environment variables.
- B. Configure the task to use the directory specified by the TEMP environment variable.
- C. Ensure the task completes with an errorlevel of 0.
- D. Change the task from simple to foreground.
Correct answer: C
Explanation
The correct answer is C because a startup task must complete successfully for the worker role to start, which is indicated by an errorlevel of 0. Options A and B do not address the completion status of the startup task, and option D, while it changes the task's type, does not guarantee that the worker role will start if the task does not succeed.