asp.net-mvc - 网站未在 Azure 本地运行

标签 asp.net-mvc azure azure-cloud-services

编辑:以管理员身份运行 Visual Studio 可以解决以下问题,但有人可以解释为什么我需要以管理员身份运行才能在 Azure 模拟器中运行网站吗?

我们正在将网站迁移到 Windows Azure,我已经创建了一个云服务并将网站添加为 Web 角色,当我尝试在调试中启动云服务项目时,它不会启动,并且在输出显示:

The program '[12396] WaIISHost.exe' has exited with code 0 (0x0).

左下角写着“操作已取消”。我似乎找不到发生这种情况的任何原因,如果我创建一个空白的 asp.net mvc 网站,它工作正常,所以我们的应用程序中一定有某些东西导致它像这样爆炸,有人知道如何做吗去追踪这个问题吗?

我只花了一秒钟时间查看模拟器输出,但它说:

[fabric] Role Instance: deployment24(29).xxx.Web.0
[fabric] Role state Busy
[fabric] Role state Unhealthy
[fabric] Role state Stopped

我在 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

查看\AppData\Local\dftmp\Resources{guid}\directory\DiagnosticStore 的日志,WaIISHost.log 中存在以下错误:

WaIISHost 信息:0:[00006516:00000001,2014/09/14 06:43:23.994,错误] 异常:System.ServiceModel.FaultException`1[System.ServiceModel.ExceptionDetail]:尝试执行未经授权的操作。 (Fault Detail 等于 An ExceptionDetail,可能由 IncludeExceptionDetailInFaults=true 创建,其值为: System.UnauthorizedAccessException:尝试执行未经授权的操作。 在 System.Security.AccessControl.Win32.SetSecurityInfo(ResourceType 类型、字符串名称、SafeHandle 句柄、SecurityInfos securityInformation、SecurityIdentifier 所有者、SecurityIdentifier 组、GenericAcl sacl、GenericAcl dacl)

最佳答案

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

现在有一个“Express Emulator”选项可以缓解这一问题,但每个角色仅限一个实例,并且必须允许 IIS 使用随机高端口。有关在 Express 模拟器模式下运行的说明,请访问 http://msdn.microsoft.com/en-us/library/azure/dn339018.aspx .

这个类似的问题还有更多信息:Windows Azure emulator without admin privileges

关于asp.net-mvc - 网站未在 Azure 本地运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25824941/

相关文章:

asp.net - 使用 Azure ADFS 和 OWIN 进行 SSO

azure - 如果 Azure Function App 在消费计划中缩小到 0,它如何监听来自事件中心的传入事件?

c# - Azure 云服务 OnStop

javascript - 通过 AJAX 上传到 Azure 云存储的文件已损坏

c# - 如何在 ASP.NET MVC 应用程序中使用 OracleMembershipProvider

asp.net - SetAuthCookie 设置 Cookie,但不在后续请求中设置 IsAuthenticated

azure - 我需要更改 Azure 应用服务中的哪些设置才能允许在 App_Offline 中使用 Base64 图像?

.net - Web API 接口(interface)在本地工作,但在部署到 Azure 网站后得到 404

c# - 如何在Web API中使用 "User.Identity.IsAuthenticated"

c# - 与 System.Web.Mvc 的版本冲突