2
votes

I have a flask application running on Azure. It has been running just fine until I updated the Azure service plan from "D1 Shared" to "S1 Standard".

When trying to access the application, I get the follow error:

Server Error in '/' Application.

Couldn't find type for class Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener, Microsoft.WindowsAzure.Diagnostics, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35.

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.Configuration.ConfigurationErrorsException: Couldn't find type for class Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener, Microsoft.WindowsAzure.Diagnostics, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35.

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:

[ConfigurationErrorsException: Couldn't find type for class Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener, Microsoft.WindowsAzure.Diagnostics, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35.]
System.Diagnostics.TraceUtils.GetRuntimeObject(String className, Type baseType, String initializeData) +6967379
System.Diagnostics.TypedElement.BaseGetRuntimeObject() +45
System.Diagnostics.ListenerElement.GetRuntimeObject() +83
System.Diagnostics.ListenerElementsCollection.GetRuntimeObject() +142 System.Diagnostics.TraceInternal.get_Listeners() +185
System.Diagnostics.TraceInternal.WriteLine(String message) +119
System.Diagnostics.Debug.WriteLine(String message) +9
Microsoft.Web.Compilation.Snapshots.SnapshotHelper.RestoreSnapshot(String options) +359

[TargetInvocationException: Exception has been thrown by the target of an invocation.] System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) +0
System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) +160
System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +101 System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams) +2026
System.Web.Compilation.BuildManager.RestorePortableCompilationOutputSnapshot() +10008589 System.Web.Compilation.BuildManager.ExecutePreAppStart() +18 System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +531

[HttpException (0x80004005): Exception has been thrown by the target of an invocation.]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9963380 System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +101 System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +254

I've tried to change the service plan back to "D1 Shared", then the application runs fine once again.

I have seen a lot of posts all saying to make sure that the solution has a reference to the "Microsoft.Azure.Plugins.Diagnostics.dll". I have tried to do this by "Right click" -> "References" -> "Add Reference..." -> ".NET" -> "Microsoft.Azure.Plugins.Diagnostics". When I publish again I can see the dll in the "bin" folder. But I still get the same error.

Am I making the reference in the wrong way? If so, how do I do it correctly.

Is there anything else I should do to make my solution work with "S1 Standard"?

1
There are two resolved SO threads stackoverflow.com/questions/38200782/… and stackoverflow.com/questions/36236008/… which get the similar issue with yours. Please try to refer to them and check whether exists the same issue for your app. Any update, please let me know.Peter Pan
The two threads you are referencing to are not the same issue. Both of them get "Internal Server Error", which means that the application has crashed. In my case, the application is running, but not when I upgrade the Azure Service Plan, then I get an error due to a missing dll file (which I cannot seem to add/include in the correct way). But thanks for your comment anyways.Silverbaq

1 Answers

1
votes

This is the solution:

Disable the Dynamic Cache by going to the Azure Portal -> Application Settings and then setting the value of 'WEBSITE_DYNAMIC_CACHE' to '0' (zero).

After completing these steps try to scale up your pricing tier from Shared to Standard. enter image description here