1
votes

I have Diagnostic trace listener on in my application deployed on web role. Everything works fine in development environment when run through emulator. But I am receiving following error when deployed on azure 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() +518 Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener..ctor() +34

[ConfigurationErrorsException: Could not create Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener, Microsoft.WindowsAzure.Diagnostics, Version=2.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35.] System.Diagnostics.TraceUtils.GetRuntimeObject(String className, Type baseType, String initializeData) +9004943 System.Diagnostics.TypedElement.BaseGetRuntimeObject() +110 System.Diagnostics.ListenerElement.GetRuntimeObject() +989 System.Diagnostics.ListenerElementsCollection.GetRuntimeObject() +252 System.Diagnostics.TraceInternal.get_Listeners() +331 System.Diagnostics.TraceInternal.WriteLine(String message) +161 AVAWebApplication.Global.Application_Start(Object sender, EventArgs e) +28

[HttpException (0x80004005): Could not create Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener, Microsoft.WindowsAzure.Diagnostics, Version=2.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35.] System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app) +581 System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +179 System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +322 System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +384 System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +397

[HttpException (0x80004005): Could not create Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener, Microsoft.WindowsAzure.Diagnostics, Version=2.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35.] System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +678 System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +159 System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +810

Can Anybody please help ?

1

1 Answers

0
votes

DotNetOpenAuth.Logger seems to conflict with WAD (windows azure diagnostics). Also see this post: Not running in a hosted service or the Development Fabric (Production, not debug/local)

Remove trace listener from web.config:

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