部署MVC 6网站天青导致错误502 [英] Deploying MVC 6 website to Azure results in error 502

查看:240
本文介绍了部署MVC 6网站天青导致错误502的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我曾经有部署我的asp.net 5 / mvc6网站我的Azure应用程序/网站的环境没有问题,但过去几个月我有奇怪的问题。

如果我部署我的网站的Azure,90%的时候,浏览器会自动在部署操作成功打开,它只会加载5分钟,最终会给我一个502错误或500错误超时。我可以重新部署很多次,但它永远不会工作。我无法找出一个基本的空网站和我的网站,因为空模板网站最初将工作之间的差异,但如果我做一些更改,内嵌与我的问题,网站就会给出错误,但后来当我恢复所有改变的问题,甚至用空的'Hello World网站仍然存在。

在code没有将永远不会达到远程调试是没用的,这个问题发生在似乎应用程序的启动。

更新


  

从我目前可以告诉的是,它似乎被涉及到
  解决方案,因为在同一个项目确实在新的/空的解决方案工作。一世
  有一个基本的Soluion项目/ src目录/测试/工具文件夹结构,具有
  global.json和.tfignore在解决方案的项目。 (试图删除
  global.json但没有有所作为)


该eventlog.xml给我

 查看Msvsmon对更多帮助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未能启动。端口= 11271,错误code ='-2147023829'&LT; /数据&GT;&LT; / EVENTDATA&GT;&LT; /事件&GT;&LT;事件&GT;&lt;系统&GT;&LT;供应商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未能启动。端口= 20348,错误code ='-2147023829'&LT; /数据&GT;&LT; / EVENTDATA&GT;&LT; /事件&GT;&LT;事件&GT;&lt;系统&GT;&LT;供应商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未能启动。端口= 27433,错误code ='-2147023829'&LT; /数据&GT;&LT; / EVENTDATA&GT;&LT; /事件&GT;&LT;事件&GT;&lt;系统&GT;&LT;供应商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未能启动。端口= 33738,错误code ='-2147023829'&LT; /数据&GT;&LT; / EVENTDATA&GT;&LT; /事件&GT;&LT;事件&GT;&lt;系统&GT;&LT;供应商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未能启动。端口= 20405,错误code ='-2147023829'&LT; /数据&GT;&LT; / EVENTDATA&GT;&LT; /事件&GT;&LT;事件&GT;&lt;系统&GT;&LT;供应商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未能启动。端口= 16859,错误code ='-2147023829'&LT; /数据&GT;&LT; / EVENTDATA&GT;&LT; /事件&GT;&LT;事件&GT;&lt;系统&GT;&LT;供应商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未能启动。端口= 23996,错误code ='-2147023829'&LT; /数据&GT;&LT; / EVENTDATA&GT;&LT; /事件&GT;&LT;事件&GT;&lt;系统&GT;&LT;供应商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未能启动。端口= 9206,错误code ='-2147023829'&LT; /数据&GT;&LT; / EVENTDATA&GT;&LT; /事件&GT;&LT;事件&GT;&lt;系统&GT;&LT;供应商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'无法启动。端口= 9307,错误code ='-2147023829'&LT; /数据&GT;&LT; / EVENTDATA&GT;&LT; /事件&GT;&LT;事件&GT;&lt;系统&GT;&LT;供应商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未能启动。端口= 27060,错误code ='-2147023829'&LT; /数据&GT;&LT; / EVENTDATA&GT;&LT; /事件&GT;&LT;事件&GT;&lt;系统&GT;&LT;供应商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未能启动。端口= 31282,错误code ='-2147023829'&LT; /数据&GT;&LT; / EVENTDATA&GT;&LT; /事件&GT;&LT;事件&GT;&lt;系统&GT;&LT;供应商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未能启动。端口= 23608,错误code ='-2147023829'&LT; /数据&GT;&LT; / EVENTDATA&GT;&LT; /事件&GT;&LT;事件&GT;&lt;系统&GT;&LT;供应商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未能启动。端口= 15739,错误code ='-2147023829'&LT; /数据&GT;&LT; / EVENTDATA&GT;&LT; /事件&GT;&LT;事件&GT;&lt;系统&GT;&LT;供应商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未能启动。端口= 13495,错误code ='-2147023829'&LT; /数据&GT;&LT; / EVENTDATA&GT;&LT; /事件&GT;&LT;事件&GT;&lt;系统&GT;&LT;供应商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'无法启动。端口= 6457,错误code ='-2147023829'&LT; /数据&GT;&LT; / EVENTDATA&GT;&LT; /事件&GT;&LT;事件&GT;&lt;系统&GT;&LT;供应商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未能启动。端口= 32023,错误code ='-2147023829'&LT; /数据&GT;&LT; / EVENTDATA&GT;&LT; /事件&GT;&LT;事件&GT;&lt;系统&GT;&LT;供应商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未能启动。端口= 9729,错误code ='-2147023829'&LT; /数据&GT;&LT; / EVENTDATA&GT;&LT; /事件&GT;&LT; /新闻与GT;

我的web.config是默认的。

 &LT;&处理GT;
      &LT;添加名称=htt​​pPlatformHandler路径=*动词=*的模块=htt​​pPlatformHandler= resourceType为未指定/&GT;
    &LT; /处理器&GT;
    &LT; httpPlatform processPath =%DNX_PATH%参数=%DNX_ARGS%stdoutLogEnabled =假startupTimeLimit =3600/&GT;


解决方案

完全重建我的第二次​​测试的解决方案,解决方案,并在项目和引用添加一步一步,并试图找到突破点后,我注意到,当我添加了另一个类LIB(相当大的一个),该解决方案从我MVC6引用它程序的时候,将打破。如果我再删除引用它仍然被打破所以它似乎是一个无法修复的问题。一些试验和错误的之后,我开始在包和包文件夹的参考搞乱,最后发现这个问题。

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

也改为DNX46,而不是451(即尝试过,但没有做出关于这一问题的差)。

构建将删除6.xxx文件,但重新启动Visual Studio将解决这个问题后,开始打破。

在这些步骤我部署到Azure和一切工作。我现在尝试此修复程序在多个解决方案,有完全相同的问题,这似乎是一个坚实的修补程序。

这可能是因为有东西在我引用的类的lib引起此版本问题,因为创建空白类库一个新的解决方案/ MVC项目将正常工作,但无论哪种方式,我很高兴这是解决了。

I used to have no problem with deploying my asp.net 5/mvc6 website to my Azure apps/website environment, but last months I'm having weird issues.

If I deploy my website to Azure, 90% of the times, the browser will be opened automatically when the deploy succeeded, and it will just load for 5 minutes and eventually will give me a 502 error or a 500 error for timeout. I can redeploy many times but it will never work. I can't pinpoint the difference between a basic empty website and my website because the empty template website will initially work, but if I make some changes to it inline with my problem-website it will give the error, but then when I revert all changes the problem persists even with a empty 'hello world' website.

None of the code will ever be reached to remote debugging is useless, the problem happens in the startup of the app it seems.

update

From what I can tell so far is that it seems be related to the solution, since the same project does work in a new/empty solution. I have a basic Soluion Items/src/test/tools folder structure, with a global.json and .tfignore in the Solution Items. (tried deleting global.json but didnt make a difference)

The eventlog.xml gives me

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>

My web.config are default.

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

解决方案

After completely recreating my solution in a 2nd test-solution, and adding in projects and references step by step and trying to find the breaking point, I noticed that when I added another class lib (quite a large one) to the solution and reference it from my MVC6 app it would break. If I would then remove the reference it would still be broken so it seemed like a unfixable issue. After some trial and error's I started messing with the references in the packages and wrap-folders, and eventually found the issue.

By default the asp.net libs use an embedded Newtonsoft.json version 6.xxx. I added the latest version of Newtonsoft.json (8.xx) to my MVC 6 project, then deleted the (old) newtonsoft folders/files from the wrap and packages folder.

Also changed to DNX46 instead of 451 (tried that before, but didnt make a difference regarding the issue).

The build would break initially after deleting the 6.xxx files but rebooting Visual Studio will fix this.

After these steps I deployed to Azure and everything worked. I tried this fix in multiple solutions now that had the exact same issue and it seems to be a solid fix.

It could be that there is something in my referenced class lib that is causing this versioning issue since creating a new solution with blank class libs/mvc projects will work fine, but either way I'm glad this is resolved.

这篇关于部署MVC 6网站天青导致错误502的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆