8
votes

I have a problem related to the webRole debugging.

Not running in a hosted service or the Development Fabric. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InvalidOperationException: Not running in a hosted service or the Development Fabric.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[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

This is the web.config part concerning Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener

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

2

2 Answers

14
votes

One thing to check: Make sure your cloud project is set as the startup project.

5
votes

Most of the Azure diagnostics require administrative rights. You may not have started the Windows Azure Compute Emulator as an Administrator and that is the reason why the API calls failed.

The solution – start the Windows Azure Compute Emulator as an Administrator, or let Visual Studio start the emulator (provided Visual Studio is already running with administrative rights).