【问题标题】:Fail to deploy to Azure a simple django webapp that works well on local machine无法将在本地机器上运行良好的简单 django webapp 部署到 Azure
【发布时间】:2017-05-23 15:58:28
【问题描述】:

我有一个简单的 Django webapp,它在我的机器上就像一个魅力。但是,当我尝试使用 VS 2015 将其发布到 Azure Webapp(通过右键单击项目然后单击发布按钮)时,结果出现运行时错误:

然后我尝试通过将“”添加到 web.config 文件来进行修复。原来是另一个错误: Server Error in '/' Application. Couldn't find type for class Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener, Microsoft.WindowsAzure.Diagnostics, Version=1.0.0.0, Culture=neutral, ..

我尝试了 thisthis 教程,但它们没有帮助。我不知道这些文件是否已经过时了。

请拯救我的一天。

更新: 我不确定要发布哪个日志文件,因为我是 Azure 的新手。这是文件 eventlog.xml 中的内容:

<Data>D:\home\site\wwwroot\</Data>
<Data>RD0003FF2899E0</Data>
<Data/>
<Data>9328</Data>
<Data>w3wp.exe</Data>
<Data>IIS APPPOOL\DjangoWebProject220170522042402</Data>
<Data>TargetInvocationException</Data>
<Data>Exception has been thrown by the target of an invocation.
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
   at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams)
   at System.Web.Compilation.BuildManager.RestorePortableCompilationOutputSnapshot()
   at System.Web.Compilation.BuildManager.ExecutePreAppStart()
   at System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException)

Couldn't find type for class Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener, Microsoft.WindowsAzure.Diagnostics, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35.
   at System.Diagnostics.TraceUtils.GetRuntimeObject(String className, Type baseType, String initializeData)
   at System.Diagnostics.TypedElement.BaseGetRuntimeObject()
   at System.Diagnostics.ListenerElement.GetRuntimeObject()
   at System.Diagnostics.ListenerElementsCollection.GetRuntimeObject()
   at System.Diagnostics.TraceInternal.get_Listeners()
   at System.Diagnostics.TraceInternal.WriteLine(String message)
   at Microsoft.Web.Compilation.Snapshots.SnapshotHelper.RestoreSnapshot(String options)

</Data>
            <Data>http://djangowebproject220170522042402.azurewebsites.net/handler.fcgi/</Data>
            <Data>/handler.fcgi/</Data>
            <Data>62.177.198.5</Data>
            <Data/>
            <Data>False</Data>
            <Data/>
            <Data>IIS APPPOOL\DjangoWebProject220170522042402</Data>
            <Data>21</Data>
            <Data>IIS APPPOOL\DjangoWebProject220170522042402</Data>
            <Data>False</Data>
            <Data>   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
   at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams)
   at System.Web.Compilation.BuildManager.RestorePortableCompilationOutputSnapshot()
   at System.Web.Compilation.BuildManager.ExecutePreAppStart()
   at System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException)
</Data>

还有 DetailErrors 文件:

<fieldset><h4>Most likely causes:</h4> 
<ul>    <li>IIS received the request; however, an internal error occurred during the processing of the request.
The root cause of this error depends on which module handles the request and 
what was happening in the worker process when this error occurred.</li>     
<li>IIS was not able to access the web.config file for the Web site or 
application. 
This can occur if the NTFS permissions are set incorrectly.</li>    <li>IIS 
was not able to process configuration for the Web site or application.</li>     
<li>The authenticated user does not have permission to use this DLL.</li>   
<li>The request is mapped to a managed handler but the .NET Extensibility 
Feature is not installed.</li> </ul> 
</fieldset> 
</div> 
<div class="content-container"> 
<fieldset><h4>Things you can try:</h4> 
<ul>    <li>Ensure that the NTFS permissions for the web.config file are correct and allow access to the Web server's machine account.</li>     <li>Check the event logs to see if any additional information was logged.</li>  <li>Verify the permissions for the DLL.</li>    <li>Install the .NET Extensibility feature if the request is mapped to a managed handler.</li>  <li>Create a tracing rule to track failed requests for this HTTP status code. For more information about creating a tracing rule for failed requests, click <a href="http://go.microsoft.com/fwlink/?LinkID=66439">here</a>. </li> </ul> 
</fieldset> 
</div> 

【问题讨论】:

标签: django azure azure-web-app-service web-deployment


【解决方案1】:

我尝试了 this 线程的解决方案,它奏效了:

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

【讨论】:

    猜你喜欢
    • 2020-01-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-02-25
    • 2022-12-18
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多