My Azure Cloud Service's Web Role works fine when deployed to Azure but can't get it running with the Emulator.
- When starting the role from within Visual Studio (2015) the window just displays "Starting the roles for the application in the Microsoft Azure compute emulator...".
- When starting with the debugger
OnStart()
doesn't seem to be hit at all, so something before that gets stuck. The role doesn't seem to be started because the app's custom logs are not created either. - Looking at the Compute Emulator's UI reveals that the role is continuously (and very slowly) cycling between Unknown and Destroyed states.
- There seems to be nothing relevant logged to the Event Logs (see this answer) apart from messages about SSL certificates being added for the HTTPS endpoints (see below)
Any idea where can I look for clues on what makes the role stuck?
The Output window in VS has this as the last message:
Microsoft Azure Tools: Warning: Attempting to bind SSL Certificate with identity sha1:something for endpoint named HTTPS of role RoleName.
The role has some SSL certificates defined as well as an HTTP and two HTTPS endpoints. However removing these didn't seem to solve the problem, then it gets stuck on this (added automatically because RDP access is enabled):
Microsoft Azure Tools: Warning: Certificate identification setting 'Microsoft.WindowsAzure.Plugins.RemoteAccess.PasswordEncryption' for role 'RoleName' specified in the service configuration file is not declared in the service definition file in the Certificate or as part of an SSL endpont
(Notice the typo at the end :-).)
I've taken a look at the logs under C:\Users\Me\AppData\Local\dftmp. The logs and EmulatorRuntimeLogs folders are empty, DFAgentLogs\DFAgent.log contains some entries, this is what gets repeated:
[2017/01/29, 21:27:55.532, ERROR, 00019400] <- RuntimeRole::CreateRoleProcess(0x00000224DE6EA670) =0x80070057 [2017/01/29, 21:27:55.644, ERROR, 00019400] <- RuntimeRole::StartRoleProcess(0x00000224DE6EA670) =0x80070057 [2017/01/29, 21:27:55.748, ERROR, 00019400] <- RuntimeRole::LaunchDevExRoleHost(0x00000224DE6EA670) =0x80070057 [2017/01/29, 21:27:55.838, ERROR, 00019400] <- RuntimeRole::StartUnsafe(0x00000224DE6EA670) =0x80070057 [2017/01/29, 21:27:55.922, ERROR, 00019400] <- RuntimeRole::Start(0x00000224DE6EA670) =0x80070057 [2017/01/29, 21:27:56.021, ERROR, 00019400] <- RuntimeBaseContainer::StartRole_Unsafe(0x00000224DE681BE0) =0x80070057 [2017/01/29, 21:27:56.055, ERROR, 00019400] <- RuntimeBaseContainer::StartRole(0x00000224DE681BE0) =0x80070057 [2017/01/29, 21:27:56.079, ERROR, 00019400] <- RuntimeStartRole=0x80070057 [2017/01/29, 21:27:56.110, INFO, 00019400] StartRoleResult deployment29(73).RoleName_IN_0, 80070057 [2017/01/29, 21:27:56.110, INFO, 00019400] Got Notify [2017/01/29, 21:27:56.110, INFO, 00019400] DestroyRoleConfigResources: RoleName_IN_0:0:cb0b9125-93b1-43e7-9780-f5c6a15f435a [2017/01/29, 21:27:56.110, INFO, 00019400] Got Notify [2017/01/29, 21:27:56.110, INFO, 00019400] StartRoleWorker returned 0x80070057 [2017/01/29, 21:27:56.114, INFO, 00013244] Called GetState [2017/01/29, 21:27:56.114, INFO, 00013244] There are 3 notifications. [2017/01/29, 21:27:56.114, INFO, 00013244] Role notifications 0, Instance: RoleName_IN_0:0:cb0b9125-93b1-43e7-9780-f5c6a15f435a State: 2 [2017/01/29, 21:27:56.114, INFO, 00013244] Role notifications 1, Instance: RoleName_IN_0:0:cb0b9125-93b1-43e7-9780-f5c6a15f435a State: 10 [2017/01/29, 21:27:56.114, INFO, 00013244] Role notifications 2, Instance: RoleName_IN_0:0:cb0b9125-93b1-43e7-9780-f5c6a15f435a State: 11 [2017/01/29, 21:27:56.114, INFO, 00013244] There are 1 completion events. [2017/01/29, 21:27:56.114, INFO, 00013244] CompletionEvent 0, Type: StartRoleCompleted Id: deployment29(73).RoleName_IN_0 Status: 0x2147942487 [2017/01/29, 21:27:56.114, INFO, 00013244] GetState returned. [2017/01/29, 21:27:56.115, INFO, 00015700] Called AcknowledgeNotifications [2017/01/29, 21:27:56.115, INFO, 00015700] Cleanup the notifications and completion events, last sequence = 3317 [2017/01/29, 21:27:56.115, INFO, 00013244] Called StartRole [2017/01/29, 21:27:56.115, INFO, 00013244] StartRole returned. [2017/01/29, 21:27:56.115, INFO, 00019400] StartRoleWorker, instance = deployment29(73).RoleName_IN_0 [2017/01/29, 21:27:56.116, WARN, 00019400] Role deployment29(73).RoleName_IN_0 not found. [2017/01/29, 21:27:56.116, ERROR, 00019400] <- RuntimeContainer::FindRoleUnsafe=0x80070490 [2017/01/29, 21:27:56.135, INFO, 00019400] SetupRoleConfigResources: RoleName_IN_0:0:cb0b9125-93b1-43e7-9780-f5c6a15f435a [2017/01/29, 21:27:56.136, INFO, 00019400] Got Notify [2017/01/29, 21:27:56.136, INFO, 00019400] Starting Role [2017/01/29, 21:27:56.140, INFO, 00019400] Runtime Server Named Pipe Name = \.\pipe\RdRuntimeServer. [2017/01/29, 21:27:56.140, INFO, 00019400] Runtime Server Named Pipe Timeout Time = 30. [2017/01/29, 21:27:56.140, ERROR, 00019400] Failed to create process "path\to\role\project's\folder\csx\Debug\roles\Lombiq.Hosting.RequestRouter.RouterRole\base\x64\WaHostBootstrapper.exe" base\x64\WaIISHost.exe .
However I have no idea why the process couldn't be created (the file is there; although my username has an accented character in it and thus in the path, it didn't help to move the folder to the drive root) and there seems to be no other information anywhere. The Storage and Compute Emulator otherwise starts and works.
These didn't help:
- Running VS as administrator.
- Separately pre-starting the Compute Emulator as an administrator.
- Checking if it has to do something with the user account: It also works on another machine on mine, which has the same Windows user account.
- Disabling Windows firewall.
- Updating the Azure SDK from 2.9 to 3.0.
- Updating the role's (Azure-related) NuGet packages to latest.
- Repairing the VS installation.
The same solution works on one of my colleague's machine, so it should be some issue with my machine, and this specific one.
I also tried this with an empty Cloud Service project with an empty ASP.NET role and the same happens.
A similar question: Azure Emulator appears to Hanging on Web Role startup.
Update, getting closer:
I'm also getting these in the Event Log under Windows Logs/System:
The application-specific permission settings do not grant Local Activation permission for the COM Server application with CLSID {6B3B8D23-FA8D-40B9-8DBD-B950333E2C52} and APPID {4839DDB7-58C2-48F5-8283-E1D1807D0D7D} to the user NT AUTHORITY\LOCAL SERVICE SID (S-1-5-19) from address LocalHost (Using LRPC) running in the application container Unavailable SID (Unavailable). This security permission can be modified using the Component Services administrative tool.
The machine-default permission settings do not grant Local Activation permission for the COM Server application with CLSID {C2F03A33-21F5-47FA-B4BB-156362A2F239} and APPID {316CDED5-E4AE-4B15-9113-7055D84DCC97} to the user NT AUTHORITY\LOCAL SERVICE SID (S-1-5-19) from address LocalHost (Using LRPC) running in the application container Unavailable SID (Unavailable). This security permission can be modified using the Component Services administrative tool.
This is the issue described and solved here: https://sajiviswam.wordpress.com/2011/04/15/the-machine-default-permission-settings-do-not-grant-local-activation-permission-for-the-com-server-application-with-clsid-000c101c-0000-0000-c000-000000000046-sharepoint-2010/ In my case the affected services are ShellServiceHost and Immersive Shell (contrary to what the blogpost says, I had to look up the CLSID entries in the registry under HKCR\CLSID. I restarted my computer after setting the permissions for the Registry entries, but the security settings of the two components are still grayed out.
Apart from what's in the blogpost under “Change Component Service Owner and Permission” I tried multiple ways to resolve this, without success: setting this up for the Administrator_s_ group, then also giving full control (after a restart) for the Administrator (singular) user; enabling permission inheritance; changing the owner to my (administrator-level) user. I also tried to replace owner with Administrator_s_, and opt to replace all child object permission entries as well.
Still the security settings of the two components are grayed out.
Update 2:
Building on what I've elaborated to be tried under the question this is what helped:
I needed to also set the permissions for the AppIDs in Regedit (see that not just CLSIDs but also APPIDs are present in the error messages) to have full control over them for the Administrators group. After this the Security tab's options weren't grayed out any more for the affected components in Component Services.
Thus I could set Local Activation permission under both components for the Local Service user.
While this gets rid of the errors in the Event Log the Emulator start is still stuck at the same step, however this time without any hint on what may be wrong.
Update 3:
Re-installing pre-3.0 Azure SDK version didn't help. On my laptop the Cloud Service can start and my hunch is that this is because that machine only has v2.9 of the SDK installed.
Related question: Azure worker role getting stuck in Role state Unknown (no solution there helped).