本文介绍了Azure服务总线中继-服务重新启动后出现502错误的网关的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在使用 Azure服务总线中继 ,用于将本地WCF服务连接到Azure托管的Web角色.当我们升级本地WCF服务时,在服务总线主机已使用中继重新建立自身之后,通过Azure服务总线,我们最初收到的几个请求总是会收到 502错误的网关响应. 我们没有得到没有在指定地址托管服务." ,因为该服务托管正确).

We are using the Azure Service Bus Relay for connecting our on-premise WCF services to our Azure-hosted Web Role. When we upgrade our on-premise WCF services, we always get a 502 Bad Gateway response from our first few requests through the Azure Service Bus, after the service bus host has re-established itself with the relay (we don't get the "No service is hosted at the specified address." since the service is hosted properly).

在给定的超时时间后-似乎错误消失了,并且WCF请求已通过中继正确处理.我们正在将 basicHttpRelayBinding 与(以防止CommunicationExceptions ).

After a given timeout period - it seems the error disappears and WCF requests are handled properly through the relay. We are using basicHttpRelayBinding with HTTP Keep-Alives disabled (to prevent CommunicationExceptions).

这是我们在从Web角色到中继的WCF请求期间捕获的错误消息:

Here is the error message we capture during the WCF requests to the relay from the web role:

<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing">
    <s:Header>
        <a:Action s:mustUnderstand="1">http://schemas.microsoft.com/netservices/2009/05/servicebus/relay/FaultAction</a:Action>
    </s:Header>
    <s:Body>
        <s:Fault>
            <s:Code>
                <s:Value>s:Receiver</s:Value>
                <s:Subcode>
                    <s:Value>s:Receiver</s:Value>
                </s:Subcode>
            </s:Code>
            <s:Reason>
                <s:Text xml:lang="en-US">50200: Bad Gateway.TrackingId:8bd21714-ae0f-41b5-b810-851b59a345fb_28,TimeStamp:5/29/2012 8:27:14 PM</s:Text>
            </s:Reason>
        </s:Fault>
    </s:Body>
</s:Envelope>

我们目前正在尝试在WCF绑定中禁用默认的Web代理(通过useDefaultWebProxy=false ),但是想知道其他人是否已经通过Azure Service Bus看到了相同的HTTP 502行为,以及如何解决该问题.

We are currently trying disabling the default web proxy in the WCF Bindings (via useDefaultWebProxy=false), but are wondering if others have seen this same HTTP 502 behavior with the Azure Service Bus and how to fix it.

推荐答案

将本地WCF服务连接到Azure托管的Web角色时,我已经看到了这样的问题,这些主要是由于在本地网络中具有代理引起的.在任何企业IT环境中,所有计算机"网络设置都设置为使用代理服务器",或者自动检测",或者如果您有多个代理服务器,则实际设置要选择的代理服务器.当WCF服务连接到外部世界时,它将经历相同的代理设置,并且实际上更改了连接它的动态并引入了行为.

I have seen such problem when connecting an on-premise WCF services to Azure-hosted Web Role and these are mostly caused by having proxy in on-premise network. In any enterprise IT environment all machines network setting is set to use Proxy server either Auto detect or if you have multiple proxy server you actually set which one to choose. When WCF service connect outside world it goes through same proxy settings and that actually changes the dynamics of connecting it and introduce the behavior.

通过将 UseDefaultWebProxy设置为false ,您是在要求Web服务不要使用计算机专用的代理,而要使用用户设置,这是Web服务配置的一部分.

By setting UseDefaultWebProxy to false you are asking web service to not use machine specific proxy and use user setting which is part of your web service configuration.

我认为您在禁用Web代理并了解其工作原理方面进展良好.还可以尝试在此处.

I think you are on good track to disable the web proxy and see how it works. Also try using Service Trace Viewer for Viewing Correlated Traces and Troubleshooting here.

这篇关于Azure服务总线中继-服务重新启动后出现502错误的网关的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-28 17:40