gpt4 book ai didi

python - 更新 Azure 服务计划后 Flask 应用程序失败

转载 作者:太空宇宙 更新时间:2023-11-04 05:08:45 27 4
gpt4 key购买 nike

我有一个在 Azure 上运行的 Flask 应用程序。它一直运行得很好,直到我将 Azure 服务计划从“D1 共享”更新为“S1 标准”。

尝试访问该应用程序时,出现以下错误:

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

我尝试将服务计划更改回“D1 Shared”,然后应用程序再次正常运行。

我看过很多帖子都说要确保解决方案引用“Microsoft.Azure.Plugins.Diagnostics.dll”。我尝试通过“右键单击”->“引用”->“添加引用...”->“.NET”->“Microsoft.Azure.Plugins.Diagnostics”来执行此操作。当我再次发布时,我可以在“bin”文件夹中看到该 dll。但我仍然遇到同样的错误。

我是否以错误的方式进行引用?如果是这样,我该如何正确地做到这一点。

我还应该做些什么才能使我的解决方案适用于“S1 Standard”?

最佳答案

这是解决方案:

转到Azure 门户 -> 应用程序设置,然后将'WEBSITE_DYNAMIC_CACHE' 的值设置为“0”(零),即可禁用动态缓存。

完成这些步骤后,尝试将您的定价层从共享扩展到标准。 enter image description here

关于python - 更新 Azure 服务计划后 Flask 应用程序失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43630361/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com