无法将在本地计算机上运行良好的简单 django webapp 部署到 Azure
Fail to deploy to Azure a simple django webapp that works well on local machine
我有一个简单的 Django 网络应用程序,它在我的机器上运行得非常好。但是,当我尝试使用 VS 2015 将其发布到 Azure Webapp 时(通过右键单击项目然后单击“发布”按钮),结果出现 运行 时间错误:
然后我尝试通过将“< customErrors mode="Off"/>”添加到 web.config[=31 来修复=] 文件。事实证明另一个错误:
Server Error in '/' Application.
Couldn't find type for class
Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener,
Microsoft.WindowsAzure.Diagnostics, Version=1.0.0.0, Culture=neutral, ..
我尝试了 this and this 教程,但没有帮助。不知这些文件是否过时了。
请拯救我的一天。
更新:
由于我是 Azure 的新手,所以我不确定 post 哪个日志文件。这是文件 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>
我尝试了 个线程的解决方案并且有效:
Disable the Dynamic Cache by going to the Azure Portal -> Application
Settings and then setting the value of 'WEBSITE_DYNAMIC_CACHE' to '0'
(zero).
我有一个简单的 Django 网络应用程序,它在我的机器上运行得非常好。但是,当我尝试使用 VS 2015 将其发布到 Azure Webapp 时(通过右键单击项目然后单击“发布”按钮),结果出现 运行 时间错误:
然后我尝试通过将“< customErrors mode="Off"/>”添加到 web.config[=31 来修复=] 文件。事实证明另一个错误:
Server Error in '/' Application.
Couldn't find type for class
Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener,
Microsoft.WindowsAzure.Diagnostics, Version=1.0.0.0, Culture=neutral, ..
我尝试了 this and this 教程,但没有帮助。不知这些文件是否过时了。
请拯救我的一天。
更新: 由于我是 Azure 的新手,所以我不确定 post 哪个日志文件。这是文件 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>
我尝试了
Disable the Dynamic Cache by going to the Azure Portal -> Application Settings and then setting the value of 'WEBSITE_DYNAMIC_CACHE' to '0' (zero).