【发布时间】: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, ..
我尝试了 this 和 this 教程,但它们没有帮助。我不知道这些文件是否已经过时了。
请拯救我的一天。
更新: 我不确定要发布哪个日志文件,因为我是 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>
【问题讨论】:
-
这两个文件没有过期。
Couldn't find type for class Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener的错误对于找出真正的原因并不明确和明确。请发布更多错误详细信息和一些相关代码以帮助解决问题。 -
同时,有一些类似的 SO 线程,您可以按照现有答案尝试解决您的问题,请参阅 stackoverflow.com/questions/43630361/…、stackoverflow.com/questions/36236008/… 和 stackoverflow.com/questions/38200782/…。有任何更新,请随时告诉我。
-
谢谢,我更新了问题中的更多详细日志。
标签: django azure azure-web-app-service web-deployment