通过HTTP协议发送远程消息

MSMQ一般情况是通过tcp协议进行通讯,但如果遇到端口被禁用或防火墙,则通过HTTP协议发送消息是一个有效的解决办法。

通过HTTP协议发送消息到远程服务器

        public static void send2()
        {
            MessageQueue mq = new MessageQueue("FormatName:DIRECT=http://222.10.xx.xx/msmq/Private$/test");
            System.Messaging.Message msg = new System.Messaging.Message();
            msg.Body = "This is a test message! ->" + DateTime.Now.ToString();
            msg.Formatter = new System.Messaging.XmlMessageFormatter(new Type[] { typeof(string) });
            mq.Send(msg);
        }

另:

服务器端必须在安装消息列队选项里添加"MSMQ HTTP支持", 通过HTTP协议发送远程消息需要IIS支持,因此必须启用IIS,且MSMQ默认将其安装在iis中的"默认站点",因此,如果停用或删除后,安装MSMQ HTTP支持时会发生错, 一般启用默认站点或重新安装IIS即可解决.

出处:http://hi.baidu.com/kangson/item/ee92d80c60dc243af3eafc9d

 

相关文章:

  • 2021-06-19
  • 2021-08-11
  • 2022-03-08
  • 2022-12-23
  • 2021-09-10
  • 2021-09-15
  • 2021-05-19
  • 2021-11-27
猜你喜欢
  • 2022-01-24
  • 2021-05-26
  • 2021-10-19
  • 2021-12-12
  • 2022-03-05
  • 2022-12-23
  • 2021-12-31
相关资源
相似解决方案