繁体   English   中英

将MVC 6网站部署到Azure会导致错误502

[英]Deploying MVC 6 website to Azure results in error 502

我过去将asp.net 5 / mvc6网站部署到我的Azure应用程序/网站环境时没有问题,但是上个月我遇到了奇怪的问题。

如果我将网站部署到Azure的机率达到了90%,则部署成功后,浏览器将自动打开,仅加载5分钟,最终会出现502错误或500错误。 我可以重新部署很多次,但是它永远都行不通。 我无法查明基本空网站和我的网站之间的区别,因为空模板网站最初可以正常工作,但是如果我与问题网站内联对其进行一些更改,它将给出错误信息,但是当我恢复所有内容时即使网站为空,“问题”仍然存在。

没有任何代码将到达远程调试是没有用的,问题似乎发生在应用程序的启动中。

更新

到目前为止,我可以说的是它似乎与解决方案有关,因为同一项目确实可以在新的/空的解决方案中工作。 我有一个基本的Soluion Items / src / test / tools文件夹结构,在解决方案项目中带有global.json和.tfignore。 (尝试删除global.json,但没有改变)

eventlog.xml给了我

View Msvsmon's help for more information.</Data><Binary>08005E80</Binary></EventData></Event><Event><System><Provider Name="HttpPlatformHandler"/><EventID>1000</EventID><Level>0</Level><Task>0</Task><Keywords>Keywords</Keywords><TimeCreated SystemTime="2016-05-15T18:40:24Z"/><EventRecordID>1002678312</EventRecordID><Channel>Application</Channel><Computer>RD0003FF1D2CD5</Computer><Security/></System><EventData><Data>Process '6424' failed to start. Port = 11271, Error Code = '-2147023829'.</Data></EventData></Event><Event><System><Provider Name="HttpPlatformHandler"/><EventID>1000</EventID><Level>0</Level><Task>0</Task><Keywords>Keywords</Keywords><TimeCreated SystemTime="2016-05-15T19:40:29Z"/><EventRecordID>1006283437</EventRecordID><Channel>Application</Channel><Computer>RD0003FF1D2CD5</Computer><Security/></System><EventData><Data>Process '9840' failed to start. Port = 20348, Error Code = '-2147023829'.</Data></EventData></Event><Event><System><Provider Name="HttpPlatformHandler"/><EventID>1000</EventID><Level>0</Level><Task>0</Task><Keywords>Keywords</Keywords><TimeCreated SystemTime="2016-05-15T20:40:41Z"/><EventRecordID>1009895484</EventRecordID><Channel>Application</Channel><Computer>RD0003FF1D2CD5</Computer><Security/></System><EventData><Data>Process '9796' failed to start. Port = 27433, Error Code = '-2147023829'.</Data></EventData></Event><Event><System><Provider Name="HttpPlatformHandler"/><EventID>1000</EventID><Level>0</Level><Task>0</Task><Keywords>Keywords</Keywords><TimeCreated SystemTime="2016-05-15T21:40:56Z"/><EventRecordID>1013510812</EventRecordID><Channel>Application</Channel><Computer>RD0003FF1D2CD5</Computer><Security/></System><EventData><Data>Process '7748' failed to start. Port = 33738, Error Code = '-2147023829'.</Data></EventData></Event><Event><System><Provider Name="HttpPlatformHandler"/><EventID>1000</EventID><Level>0</Level><Task>0</Task><Keywords>Keywords</Keywords><TimeCreated SystemTime="2016-05-15T22:41:16Z"/><EventRecordID>1017131093</EventRecordID><Channel>Application</Channel><Computer>RD0003FF1D2CD5</Computer><Security/></System><EventData><Data>Process '5844' failed to start. Port = 20405, Error Code = '-2147023829'.</Data></EventData></Event><Event><System><Provider Name="HttpPlatformHandler"/><EventID>1000</EventID><Level>0</Level><Task>0</Task><Keywords>Keywords</Keywords><TimeCreated SystemTime="2016-05-15T23:41:43Z"/><EventRecordID>1020757406</EventRecordID><Channel>Application</Channel><Computer>RD0003FF1D2CD5</Computer><Security/></System><EventData><Data>Process '4208' failed to start. Port = 16859, Error Code = '-2147023829'.</Data></EventData></Event><Event><System><Provider Name="HttpPlatformHandler"/><EventID>1000</EventID><Level>0</Level><Task>0</Task><Keywords>Keywords</Keywords><TimeCreated SystemTime="2016-05-16T00:42:13Z"/><EventRecordID>1024387796</EventRecordID><Channel>Application</Channel><Computer>RD0003FF1D2CD5</Computer><Security/></System><EventData><Data>Process '8840' failed to start. Port = 23996, Error Code = '-2147023829'.</Data></EventData></Event><Event><System><Provider Name="HttpPlatformHandler"/><EventID>1000</EventID><Level>0</Level><Task>0</Task><Keywords>Keywords</Keywords><TimeCreated SystemTime="2016-05-16T01:42:48Z"/><EventRecordID>1028023000</EventRecordID><Channel>Application</Channel><Computer>RD0003FF1D2CD5</Computer><Security/></System><EventData><Data>Process '8724' failed to start. Port = 9206, Error Code = '-2147023829'.</Data></EventData></Event><Event><System><Provider Name="HttpPlatformHandler"/><EventID>1000</EventID><Level>0</Level><Task>0</Task><Keywords>Keywords</Keywords><TimeCreated SystemTime="2016-05-16T02:43:29Z"/><EventRecordID>1031663140</EventRecordID><Channel>Application</Channel><Computer>RD0003FF1D2CD5</Computer><Security/></System><EventData><Data>Process '320' failed to start. Port = 9307, Error Code = '-2147023829'.</Data></EventData></Event><Event><System><Provider Name="HttpPlatformHandler"/><EventID>1000</EventID><Level>0</Level><Task>0</Task><Keywords>Keywords</Keywords><TimeCreated SystemTime="2016-05-16T03:44:14Z"/><EventRecordID>1035308281</EventRecordID><Channel>Application</Channel><Computer>RD0003FF1D2CD5</Computer><Security/></System><EventData><Data>Process '9540' failed to start. Port = 27060, Error Code = '-2147023829'.</Data></EventData></Event><Event><System><Provider Name="HttpPlatformHandler"/><EventID>1000</EventID><Level>0</Level><Task>0</Task><Keywords>Keywords</Keywords><TimeCreated SystemTime="2016-05-16T04:44:14Z"/><EventRecordID>1038908703</EventRecordID><Channel>Application</Channel><Computer>RD0003FF1D2CD5</Computer><Security/></System><EventData><Data>Process '8212' failed to start. Port = 31282, Error Code = '-2147023829'.</Data></EventData></Event><Event><System><Provider Name="HttpPlatformHandler"/><EventID>1000</EventID><Level>0</Level><Task>0</Task><Keywords>Keywords</Keywords><TimeCreated SystemTime="2016-05-16T05:44:20Z"/><EventRecordID>1042514234</EventRecordID><Channel>Application</Channel><Computer>RD0003FF1D2CD5</Computer><Security/></System><EventData><Data>Process '9608' failed to start. Port = 23608, Error Code = '-2147023829'.</Data></EventData></Event><Event><System><Provider Name="HttpPlatformHandler"/><EventID>1000</EventID><Level>0</Level><Task>0</Task><Keywords>Keywords</Keywords><TimeCreated SystemTime="2016-05-16T06:44:30Z"/><EventRecordID>1046124390</EventRecordID><Channel>Application</Channel><Computer>RD0003FF1D2CD5</Computer><Security/></System><EventData><Data>Process '4216' failed to start. Port = 15739, Error Code = '-2147023829'.</Data></EventData></Event><Event><System><Provider Name="HttpPlatformHandler"/><EventID>1000</EventID><Level>0</Level><Task>0</Task><Keywords>Keywords</Keywords><TimeCreated SystemTime="2016-05-16T07:44:45Z"/><EventRecordID>1049739625</EventRecordID><Channel>Application</Channel><Computer>RD0003FF1D2CD5</Computer><Security/></System><EventData><Data>Process '3544' failed to start. Port = 13495, Error Code = '-2147023829'.</Data></EventData></Event><Event><System><Provider Name="HttpPlatformHandler"/><EventID>1000</EventID><Level>0</Level><Task>0</Task><Keywords>Keywords</Keywords><TimeCreated SystemTime="2016-05-16T08:45:05Z"/><EventRecordID>1053359796</EventRecordID><Channel>Application</Channel><Computer>RD0003FF1D2CD5</Computer><Security/></System><EventData><Data>Process '908' failed to start. Port = 6457, Error Code = '-2147023829'.</Data></EventData></Event><Event><System><Provider Name="HttpPlatformHandler"/><EventID>1000</EventID><Level>0</Level><Task>0</Task><Keywords>Keywords</Keywords><TimeCreated SystemTime="2016-05-16T09:45:30Z"/><EventRecordID>1056984968</EventRecordID><Channel>Application</Channel><Computer>RD0003FF1D2CD5</Computer><Security/></System><EventData><Data>Process '5272' failed to start. Port = 32023, Error Code = '-2147023829'.</Data></EventData></Event><Event><System><Provider Name="HttpPlatformHandler"/><EventID>1000</EventID><Level>0</Level><Task>0</Task><Keywords>Keywords</Keywords><TimeCreated SystemTime="2016-05-16T10:46:01Z"/><EventRecordID>1060615265</EventRecordID><Channel>Application</Channel><Computer>RD0003FF1D2CD5</Computer><Security/></System><EventData><Data>Process '7708' failed to start. Port = 9729, Error Code = '-2147023829'.</Data></EventData></Event></Events>

我的web.config是默认的。

 <handlers>
      <add name="httpPlatformHandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified"/>
    </handlers>
    <httpPlatform processPath="%DNX_PATH%" arguments="%DNX_ARGS%" stdoutLogEnabled="false" startupTimeLimit="3600"/>

看来您可能在超时或其他相关问题上遇到了一些限制。 性能,当然。 尝试将您的网络应用程序移动到标准等更强大的模式,看看是否有帮助。 接下来,要说出500/502的原因并不是那么简单。 有解决这些错误的官方指南

我将从启用此处此处所述的详细诊断开始,看看日志中是否有任何事情在进行。 另外,某些日志可通过LogFiles控制台的Debug控制台中的Kudu控制台( http://webappname.scm.azurewebsites.net ,请注意SCM)获得。

在第二个测试解决方案中完全重新创建了我的解决方案,并逐步添加项目和引用并尝试找到断点后,我注意到当我向解决方案中添加另一个类库(相当大的类)并引用它时从我的MVC6应用中会损坏。 如果我随后删除该引用,它将仍然被破坏,因此似乎是无法解决的问题。 经过一番尝试和错误之后,我开始弄乱软件包和包装文件夹中的引用,最终发现了问题。

默认情况下,asp.net库使用嵌入式Newtonsoft.json版本6.xxx。 我将最新版本的Newtonsoft.json(8.xx)添加到我的MVC 6项目中,然后从wrap和packages文件夹中删除了(旧的)newtonsoft文件夹/文件。

也更改为DNX46而不是451(之前曾尝试过,但在问题上没有任何不同)。

最初删除6.xxx文件后,构建将中断,但是重新启动Visual Studio将解决此问题。

完成这些步骤后,我部署到了Azure,一切正常。 现在,我在多个解决方案中尝试了此修复程序,这些解决方案具有完全相同的问题,而且似乎是可靠的修复程序。

我引用的类库中可能有某种原因导致此版本问题,因为使用空白类库/ mvc项目创建新的解决方案可以正常工作,但是无论哪种方式,我都高兴地解决了这一问题。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM