Usually, when Windows Azure fails to initialize the services, the portal shows the services cycling between the Initializing, Busy and Stopping states and it gets stuck in an infinite loop between these states. The following list are the most common causes for a deployment to Windows Azure may fail (even if it works locally) and how to fix them:
- Missing referenced assemblies: set CopyLocal = True for referenced assemblies not in .NET Framework 3.5 or Microsoft.WindowsAzure.ServiceRuntime (these assemblies are the only ones present in Windows Azure).
- Project built for 32bits only: Use Platform target = Any CPU (or x64). Windows Azure runs on 64 bits.
- Path too long: Use project names with less than 28 characters. Sometimes no exception is shown, to know if this is the issue, exclude all the roles but one from the Cloud Service project and run once each time to be able to view the error details in the output window when running on the Development Fabric. You should see the following error message â€œERR: Failed to complete setup of assembly (hr = 0x8007006f)â€.
- Missing files: Include all the used files in the project. Files that are not included are not published (for instance, images)
If you will perform a service upgrade, first suspend it. If you do not suspend the service and you perform an upgrade, it will never end. Apparently, it tries to return to the previous version state as part of the upgrade process, if our new version has the same issue (fails to initialize by iterating between the stopping to initializing states), it will get stuck in the middle of the process and you wonâ€™t be able to perform any action from the Azure portal, you cannot even delete the service. If this happened to you, you can try using the Azures Cmdlets to set the deployment status.
If you continue having issues, the following blog post includes more possible causes and suggestions: