【问题标题】:Not running in a hosted service or the Development Fabric不在托管服务或 Development Fabric 中运行
【发布时间】:2011-05-06 10:10:13
【问题描述】:

我有一个与 webRole 调试有关的问题。

不在托管服务或 Development Fabric 中运行。 说明:执行当前 Web 请求期间发生未处理的异常。请查看堆栈跟踪以获取有关错误及其源自代码的位置的更多信息。

异常详细信息:System.InvalidOperationException:未在托管服务或 Development Fabric 中运行。

来源错误:

在执行当前 Web 请求期间生成了未处理的异常。可以使用下面的异常堆栈跟踪来识别有关异常起源和位置的信息。

堆栈跟踪:

[InvalidOperationException: Not running in a hosted service or the Development Fabric.]
   Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitor.GetDefaultStartupInfoForCurrentRoleInstance() +169
   Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener..ctor() +57

[ConfigurationErrorsException: Could not create Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener, Microsoft.WindowsAzure.Diagnostics, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35.]
   System.Web.Security.Roles.Initialize() +2230194
   System.Web.Security.RoleManagerModule.OnLeave(Object source, EventArgs eventArgs) +68
   System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +148
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75

这是有关 Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener 的 web.config 部分

<system.diagnostics> <trace> <listeners> <add type="Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener, Microsoft.WindowsAzure.Diagnostics, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" name="AzureDiagnostics"> <filter type="" /> </add> </listeners> </trace> </system.diagnostics>

【问题讨论】:

    标签: visual-studio-2010 azure azure-appfabric


    【解决方案1】:

    要检查的一件事:确保您的云项目设置为启动项目。

    【讨论】:

    • 我的云项目设置为启动项目。我只是想调试并启动一个新的 webrole 实例,它没有使用 azure 计算模拟器,而是 ASP.net 开发服务器,我检查了 web.config,但似乎还可以。
    • 调用 System.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener 方法可能会导致 ASP.NET 运行时加载和使用需要托管服务或 Development Fabric 但仍不确定的侦听器
    【解决方案2】:

    大多数 Azure 诊断都需要管理权限。您可能没有以管理员身份启动 Windows Azure Compute Emulator,这就是 API 调用失败的原因。

    解决方案 - 以管理员身份启动 Windows Azure Compute Emulator,或让 Visual Studio 启动模拟器(前提是 Visual Studio 已经以管理员权限运行)。

    【讨论】:

      猜你喜欢
      • 2013-10-11
      • 2020-01-05
      • 2018-06-21
      • 2018-09-05
      • 2011-03-23
      • 2015-09-15
      • 2017-10-20
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多