Reputation: 570
I am trying to deploy an ASP .NET MVC4 application to Windows Azure, I have a startup task which installs MVC4. But my role is not coming online, the deployment status is:
Wating for Role to start...System start up tasks are running
Sites were deployed...
Recovering...
Wating for Role to start...System start up tasks are running
Sites were deployed...
Recovering...
Wating for Role to start...System start up tasks are running
Sites were deployed...
Recovering...
This is keep on happening.
Another intersting thing i noticed is if i RDP into the Role instance then the role become ready state..
Any one has an idea, whats going wrong here?
Thanks Anu
Upvotes: 1
Views: 515
Reputation: 1
Your startup script file should have EXIT /B 0 command in the end.
Upvotes: 0
Reputation: 570
I got the solution, the issue was the permission of the user ( i think its 'system') who runs the start-up task to install MVC4. I have updated my start-up script (installmvc4-main.cmd) to do the following:
Creates another script 'installmvc4-impl.cmd' which invokes the a power shell script 'installmvc4.ps1' with execution policy set to unrestricted.
Creates a powershell script 'installmvc4.ps1' to install mvc4 using the installer included in the package (I downloaded it from http://www.microsoft.com/en-us/download/details.aspx?id=30683)
Creates a user, add it to administrator group and schedule a task to run 'installmvc4-impl.cmd' using this user.
Here the script 'installmvc4-main.cmd':
REM Create dos script installmvc4-impl.cmd to invoke the powershell script to install MVC4 echo if "%%EMULATED%%"=="true" goto :EOF > %~dp0installmvc4-impl.cmd echo powershell -ExecutionPolicy Unrestricted %~dp0installmvc4.ps1 ^> installmvc4.ps1.log 2^>^&1 >> %~dp0\installmvc4-impl.cmd echo exit ^/B 0 >> %~dp0installmvc4-impl.cmd REM Create the powershell script installmvc4.ps1 to install MVC4 echo Invoke-Expression "%~dp0AspNetMVC4Setup.exe /q /norestart" > %~dp0installmvc4.ps1 REM Create an admin user and schedule task using this user to run the script that install MVC4 net user anuchandy Admin!@#123 /add net localgroup Administrators aunchandy /add schtasks /CREATE /TN "install-mvc4-task" /SC ONCE /SD 01/01/2020 /ST 00:00:00 /RL HIGHEST /RU anuchandy /RP Admin!@#123 /TR "%~dp0\installmvc4-impl.cmd" /F schtasks /RUN /TN "install-mvc4-task"
Note: Make sure the character encoding of the srartup task installmvc4-main.cmd is ANSI.
Upvotes: 0
Reputation: 3332
As Sandrino mentioned, startup tasks can cause this. Whenever I see that pattern, it seems that most of the time I have assemblies referenced that are on on the Azure VM that I am being deployed to.
There is a tool out there: http://gacviewer.cloudapp.net/ that will compare assemblies in your csproj file with the current Azure OS version to locate any assemblies that will need to be marked as CopyLocal=true. Note that this tool is looking at osfamily=2. VS defaults to creating osfamily=1 in your cscfg file.
This seems highly likely to me since you are deploying an MVC 4 project probably with a version of EntityFramework that is not on the Azure VM.
Upvotes: 2
Reputation: 24895
This can be caused by a startup task which is causing problems or because of your web application not working correctly. Since the diagnostics module can take a few minutes to send the logs to your storage account I suggest you connect through RDP and take a look in the Event Viewer (under Application) to see what's happening (look for errors and warnings).
Upvotes: 0