EDIT: Running Visual Studio as an administrator fixes the problem below but can someone explain why I need to run as an administrator in order to run the web site in the Azure emulator?
We are in the process of migrating our site to Windows Azure, I have created a cloud service and added the website as a web role and when I try to start the cloud service project in debug it won't start and in the output it says:
The program '[12396] WaIISHost.exe' has exited with code 0 (0x0).
And in the bottom left corner it says "Operation Cancelled". I can't seem to find any reason why this is happening, if I create a blank asp.net mvc website it works fine so there must be something in our application that is causing it to bomb like this, does anyone have any idea how to go about tracking this issue down?
I only get a second to look at the emulator output but it says:
[fabric] Role Instance: deployment24(29).xxx.Web.0
[fabric] Role state Busy
[fabric] Role state Unhealthy
[fabric] Role state Stopped
I found the following entries in waHostBootstrapper.log
[00005740:00008088, 2014/09/13, 15:57:43.320, ERROR] <- WapXmlReadRoleModel=0x1
[00005740:00008088, 2014/09/13, 15:57:43.324, ERROR] <- GetDebugger=0x1
[00005740:00008088, 2014/09/13, 15:57:43.324, ERROR] <- GetStartupTaskDebugger=0x1
[00005740:00008088, 2014/09/13, 15:57:43.324, ERROR] <- WapGetEnvironmentVariable=0x800700cb
[00005740:00008088, 2014/09/13, 15:57:43.324, ERROR] <- WapGetEnvironmentVariable=0x800700cb
[00005740:00008088, 2014/09/13, 15:57:43.324, INFO ] Executing Startup Task type=2 rolemodule=Diagnostics cmd="E:\xxx\Diagnostics\DiagnosticsAgent.exe"
[00005740:00008088, 2014/09/13, 15:57:43.325, INFO ] Executing "E:\xxx\Diagnostics\DiagnosticsAgent.exe" .
[00005740:00008088, 2014/09/13, 15:57:43.334, ERROR] <- WapGetEnvironmentVariable=0x800700cb
[00005740:00008088, 2014/09/13, 15:57:43.335, ERROR] <- WapGetEnvironmentVariable=0x800700cb
[00005740:00008088, 2014/09/13, 15:57:43.335, INFO ] Executing Startup Task type=0 rolemodule=Diagnostics cmd="E:\xxx\Diagnostics\DiagnosticsAgent.exe" /blockStartup
[00005740:00008088, 2014/09/13, 15:57:43.335, INFO ] Executing "E:\xxx\DiagnosticsAgent.exe" /blockStartup.
[00005740:00002464, 2014/09/13, 15:57:43.480, INFO ] Registering client with PID 13152.
[00005740:00002464, 2014/09/13, 15:57:43.480, INFO ] Client DiagnosticsAgent.exe (13152) registered.
[00005740:00002464, 2014/09/13, 15:57:43.493, INFO ] Registering client with PID 11656.
[00005740:00002464, 2014/09/13, 15:57:43.493, INFO ] Client DiagnosticsAgent.exe (11656) registered.
[00005740:00008088, 2014/09/13, 15:57:43.564, INFO ] Program "E:\xxx\Diagnostics\DiagnosticsAgent.exe" /blockStartup exited with 0. Working Directory = E:\xxx\plugins\Diagnostics
[00005740:00008088, 2014/09/13, 15:57:43.564, INFO ] Executing "C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\Extensions\Microsoft\Windows Azure Tools\v2.4\Debugger\WindowsAzureDebugger.exe" base\x64\WaIISHost.exe .
[00005740:00008088, 2014/09/13, 15:57:43.565, INFO ] Role host process PID: 5456.
[00005740:00002464, 2014/09/13, 15:57:43.742, INFO ] Registering client with PID 16360.
[00005740:00002464, 2014/09/13, 15:57:43.742, INFO ] Client WaIISHost.exe (16360) registered.
[00005740:00002464, 2014/09/13, 15:57:43.742, INFO ] Client process WaIISHost.exe is the role host.
[00005740:00002464, 2014/09/13, 15:57:43.742, INFO ] Role host process registered.
[00005740:00008572, 2014/09/13, 15:57:43.820, INFO ] Getting status from client DiagnosticsAgent.exe (13152).
[00005740:00008572, 2014/09/13, 15:57:43.820, ERROR] Failed to connect to client DiagnosticsAgent.exe (13152).
[00005740:00008572, 2014/09/13, 15:57:43.820, ERROR] <- CRuntimeClient::OnRoleStatusCallback(0x0000000E8AE90C90) =0x800706ba
[00005740:00008572, 2014/09/13, 15:57:43.820, INFO ] Removing disconnected client: DiagnosticsAgent.exe (13152).
[00005740:00008572, 2014/09/13, 15:57:43.820, INFO ] Getting status from client DiagnosticsAgent.exe (11656).
[00005740:00008572, 2014/09/13, 15:57:43.826, INFO ] Client reported status 0.
[00005740:00008572, 2014/09/13, 15:57:43.826, INFO ] Getting status from client WaIISHost.exe (16360).
[00005740:00008572, 2014/09/13, 15:57:43.826, INFO ] Client reported status 1.
[00005740:00008572, 2014/09/13, 15:57:44.327, INFO ] Getting status from client DiagnosticsAgent.exe (11656).
[00005740:00008572, 2014/09/13, 15:57:44.331, INFO ] Client reported status 0.
[00005740:00008572, 2014/09/13, 15:57:44.331, INFO ] Getting status from client WaIISHost.exe (16360).
[00005740:00008572, 2014/09/13, 15:57:44.331, INFO ] Client reported status 1.
[00005740:00008572, 2014/09/13, 15:57:44.833, INFO ] Getting status from client DiagnosticsAgent.exe (11656).
[00005740:00008572, 2014/09/13, 15:57:44.842, INFO ] Client reported status 0.
[00005740:00008572, 2014/09/13, 15:57:44.842, INFO ] Getting status from client WaIISHost.exe (16360).
[00005740:00008572, 2014/09/13, 15:57:44.842, ERROR] Failed to connect to client WaIISHost.exe (16360).
[00005740:00008572, 2014/09/13, 15:57:44.842, ERROR] <- CRuntimeClient::OnRoleStatusCallback(0x0000000E8AE90CF0) =0x800706ba
[00005740:00008572, 2014/09/13, 15:57:44.842, INFO ] Client process WaIISHost.exe is the role host.
[00005740:00008572, 2014/09/13, 15:57:44.842, WARN ] Failed to contact the role host process. Treat role as unhealthy.
[00005740:00017556, 2014/09/13, 15:57:45.295, INFO ] Sending shutdown notification to client DiagnosticsAgent.exe (11656).
[00005740:00017556, 2014/09/13, 15:57:45.301, INFO ] Sending shutdown notification to client WaIISHost.exe (16360).
[00005740:00017556, 2014/09/13, 15:57:45.302, ERROR] Failed to connect to client WaIISHost.exe (16360).
[00005740:00017556, 2014/09/13, 15:57:45.302, ERROR] <- CRuntimeClient::OnRoleShutdownCallback(0x0000000E8AE90CF0) =0x800706ba
Looking in the logs at \AppData\Local\dftmp\Resources{guid}\directory\DiagnosticStore there are errors in the WaIISHost.log which are:
WaIISHost Information: 0 : [00006516:00000001, 2014/09/14 06:43:23.994, ERROR] Exception:System.ServiceModel.FaultException`1[System.ServiceModel.ExceptionDetail]: Attempted to perform an unauthorized operation. (Fault Detail is equal to An ExceptionDetail, likely created by IncludeExceptionDetailInFaults=true, whose value is: System.UnauthorizedAccessException: Attempted to perform an unauthorized operation. at System.Security.AccessControl.Win32.SetSecurityInfo(ResourceType type, String name, SafeHandle handle, SecurityInfos securityInformation, SecurityIdentifier owner, SecurityIdentifier group, GenericAcl sacl, GenericAcl dacl)