4

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)

4

1 回答 1

2

模拟器需要管理员权限才能执行其多项任务。它需要控制 IIS,需要(通常)打开 1024 以下的端口,并且需要对工作进程具有控制权限。由于 Visual Studio 正在生成和控制它,这意味着 Visual Studio 也需要这些权限。

现在有一个“Express Emulator”选项可以缓解这种情况,但是每个角色只能使用一个实例,并且必须允许 IIS 使用随机的高端口。可以在http://msdn.microsoft.com/en-us/library/azure/dn339018.aspx找到在 Express Emulator 模式下运行的说明。

这个类似的问题也有更多信息:没有管理员权限的 Windows Azure 模拟器

于 2014-11-14T14:41:13.510 回答