无法向Azure部署一个在本地计算机上运行良好的简单django webapp

时间:2017-05-22 15:39:52

标签: django azure azure-web-sites web-deployment

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

enter image description here

然后我尝试通过在 web.config 文件中添加“< customErrors mode =”Off“/> ”进行修复。结果是另一个错误: 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> 

1 个答案:

答案 0 :(得分:0)

我尝试了来自this线程的解决方案并且有效:

  

转到Azure门户禁用动态缓存 - &gt;应用   设置,然后将“ WEBSITE_DYNAMIC_CACHE ”的值设置为“ 0 ”   (零)。