Azure 网站错误 502

Azure Website Error 502(Azure 网站错误 502)
本文介绍了Azure 网站错误 502的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Azure 上有一个 ASP.NET Webforms 应用程序,但在某些网站上总是出现以下错误:502 - Web 服务器在充当网关或代理服务器时收到无效响应.

I have an ASP.NET Webforms Application on Azure but i always get the following Error on some sites: 502 - Web server received an invalid response while acting as a gateway or proxy server.

我已经阅读了很多关于 Azure 上的 502 错误的主题,但我仍然不明白在我的特定情况下的问题是什么.

I already read a lot of topics regarding the 502 error on Azure but i still don't understand what the problem in my particular situation is.

该错误仅发生在应用程序的某个站点上.我总是可以重现以下模式:

The error occurs just on some site of the application. I can always reproduce the following pattern:

  • 打开 SITENAME.azurewebsites.net -> 发生错误
  • 打开 SITENAME.azurewebsites.net/Site1.aspx -> 未发生错误
  • 打开 SITENAME.azurewebsites.net/Site2.aspx -> 未发生错误
  • 刷新 SITENAME.azurewebsites.net/Site2.aspx -> 发生错误,直到我再次调用 Site1.aspx 才会消失

我在日志中发现的唯一内容是,应用程序加载 System.Windows.Forms.dll 并且出现 AccessViolationException.我完全不知道为什么要加载这个 dll,因为 Visual Studio 的任何项目中都没有对它的引用,但那是另一个故事 :).

The only thing i found in the log is, that the application loads System.Windows.Forms.dll and there is an AccessViolationException. I have no idea why this dll is loaded at all because there is no Reference in any Project in Visual Studio to it but thats another story :).

但我不明白的是,错误 502 并不总是发生在站点 502 上.也许有人可以给我一个提示可能是什么问题或者我怎么能找到它......

But what i don't understand is that the error 502 does not always occur on Site 502. Maybe someone can give me a hint what might be the problem or how i could find it...

感谢您的帮助!

我忘了提及:在我读到的有关此错误的一些线程中,它发生在 3 分钟或类似的时间后.在我的情况下,几乎总是大约 25 秒,直到出现错误消息.

What i forgot to mention: In some threads regarding this error i read, that it occurs after 3 minutes or something like that. In my case it is nearly alway about 25 seconds until the errormessage shows up.

推荐答案

这指向一个应用程序问题.您设置 502 的原因是因为工作进程正在崩溃,并且前端留下一个没有响应的请求并返回 502 来准确说明这一点.在您网站的 LogFiles 文件夹下查找 eventlog.xml.或者,您可以尝试 从VS远程调试到你的网站.

That points to an application issue. The reason you are etting 502 is because the worker process is crashing and the front end is left with a request with no response and returning a 502 to say exactly that. Look for eventlog.xml under the LogFiles folder for your website. Alternatively you can try remote debugging from VS to your website.

System.Windows.Forms.dll 包含很多 UI 代码,这些代码很可能无法在 Azure 网站沙盒中运行.加载它的原因可能是因为您正在使用程序集中的某些内容或使用该程序集中的某些内容.它不必在 Visual Studio 中列出即可加载,因为它是标准 .NET Framework 的一部分.

System.Windows.Forms.dll contains a lot of UI code that will most probably not work Azure websites sandbox. The reason it's loaded is probably because you are using something from the assembly or using something that uses something from that assembly. It doesn't have to be listed in Visual Studio to be loaded since it's a part of the standard .NET Framework.

我建议研究远程调试并找出加载的时间以及原因.

I would suggest looking into remote debugging and figuring out at what point this is getting loaded and why.

这篇关于Azure 网站错误 502的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

DispatcherQueue null when trying to update Ui property in ViewModel(尝试更新ViewModel中的Ui属性时DispatcherQueue为空)
Drawing over all windows on multiple monitors(在多个监视器上绘制所有窗口)
Programmatically show the desktop(以编程方式显示桌面)
c# Generic Setlt;Tgt; implementation to access objects by type(按类型访问对象的C#泛型集实现)
InvalidOperationException When using Context Injection in ASP.Net Core(在ASP.NET核心中使用上下文注入时发生InvalidOperationException)
LINQ many-to-many relationship, how to write a correct WHERE clause?(LINQ多对多关系,如何写一个正确的WHERE子句?)