Azure Service Bus MessageReceiver Receive()Web套接字错误 [英] Azure Service Bus MessageReceiver Receive() web sockets error

查看:120
本文介绍了Azure Service Bus MessageReceiver Receive()Web套接字错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在网络中使用c#程序,并且能够将消息发布到Azure Service Bus队列.收到它们时,我在MessageReceiver.Receive()上遇到了异常.代码和错误如下;

I am working with a c# program within my network and am able to post messages to an Azure Service Bus queue. When receiving them, I get an exception on MessageReceiver.Receive(). The code and error is below;

MessagingFactory factory = MessagingFactory.CreateFromConnectionString(QueueConnectionString);

//Receiving a message
MessageReceiver testQueueReceiver = factory.CreateMessageReceiver(QueueName);

using (BrokeredMessage retrievedMessage = testQueueReceiver.Receive(new TimeSpan(0, 0, 20)))
{
    try
    {
        var message = new StreamReader(retrievedMessage.GetBody<Stream>(), Encoding.UTF8).ReadToEnd();
        retrievedMessage.Complete();
    }
    catch (Exception ex)
    {
        Console.WriteLine(ex.ToString());
        retrievedMessage.Abandon();
    }
}

错误被抛出在

testQueueReceiver.Receive(...);

服务器拒绝了升级请求. 400此终结点仅适用于Web套接字请求

The server rejected the upgrade request. 400 This endpoint is only for web-socket requests

除了一篇帖子似乎暗示这是防火墙/端口问题外,我在网上找不到任何东西.我在本地将所有天蓝色的服务总线端口出站打开(9350-9354、80、443),但是9000防火墙有可能被阻塞.是否需要这些?任何指针将不胜感激!

I can't find anything on the web with the exception of one post which seems to suggest it is a firewall / ports issue. I have all the azure service bus ports outbound open (9350-9354, 80, 443) locally but there is a chance the 9000's are blocked at the firewall. Should it require these? Any pointers would be greatly appreciated !

服务消息通信异常-端点仅适用于Web套接字请求

推荐答案

由于某些代理问题,此问题已解决.

This was fixed due to some proxy issues.

运行代码的帐户是一个异步服务.我需要以该帐户身份登录,打开IE并转到连接(LAN)并删除代理复选框(自动检测设置等).完成此操作后,代码将绕过代理并正常工作.

The account that the code was running under was an async service. I needed to log in as that account, open IE and go to connections (LAN) and remove the proxy checkboxes (detect settings automatically, etc). Once this was done, the code bypassed the proxy and worked fine.

这篇关于Azure Service Bus MessageReceiver Receive()Web套接字错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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