[Original] Use HTTP protocol to send messages in msmq3.0

Source: Internet
Author: User
Tags iis msmq metabase

1. Declare first:
MSMQ3.0 is supported only in WinXP and Win2003, if Windows Vista systems are said to have started supporting msmq4.0

2. Why to send messages using the HTTP protocol
When you access the Internet to send a message remotely, msmq2.0 is already starting to support TCP, but if the extranet server is quarantined with a firewall or other network device between the sender, or if the port required by TCP on the server is not open, the TCP method will not be sent. The HTTP protocol uses the default 80 port, the general server will open the end of this port, and only the HTTP protocol can penetrate the firewall

Installation issues for 3.msmq3.0
When you install Message Queuing on Windows XP, MSMQ already has HTTP protocol support installed by default, and on Windows2003, the default installed Message Queuing is not supported by HTTP, and you need to add/Remove Windows Components--> Application Server --> "MSMQ http Support" in "Message Queuing"--> "Details" Ching

In addition, msmq3.0 is required to create MSMQ virtual directories in the default site of IIS (that is, identified as W3WVC1,MSMQ in the installation) during installation, and if you unfortunately delete the default site for IIS, You will not be able to properly install msmq3.0 HTTP support (even if you create a new default site, because the new site, whose internal metadata identity is randomly generated, not W3WVC1), provides the following error:/lm/w3svc/1/root/msmq can't find it.

Solution:
(a) Uninstall IIS, reinstall IIS, and of course, many IIS site information will be lost after reinstalling IIS
(b) Modifying the IIS meta data
First to http://www.microsoft.com/downloads/details.aspx? familyid=56fc92ee-a71a-4c73-b628-ade629c89499&displaylang=en here download an Internet Information Services (IIS) 6.0 Resource Kit Tools Run after installation

Program-->iis resources--> Metabase Explorer--> Metabase Explorer

Expand the/LM/W3SVC/node to find your current default site identification name (TIP: In IIS Management, right-click the default site--> property--> site--> Properties--> The log file name W3SVC1529656452exyymmdd.log in the bottom of the pop-up dialog box, where 1529656452 is the internal identity.

Modify the following places:
First the logo rename to 1, and then modify the root under this node and the AppRoot of the virtual directory, that is, modify the similar/lm/w3svc/1529656452/root to/lm/w3svc/1/root

Save, and then restart the IIS service, you will be able to properly install msmq3.0 HTTP support (this technique I searched all over the Google,baidu did not find, and finally tried to find out!)

4. Send code Sample:
The code is actually very simple.


MessageQueue MQ = new MessageQueue ("formatname:d Irect=http://172.134.54.4/msmq/private$/demo" );
System.Messaging.Message msg = new System.Messaging.Message ();
Msg. Body = "Hello world! "  + DateTime.Now.ToString ();
Msg. Formatter = new System.Messaging.XmlMessageFormatter (new Type[] { typeof(string)} );
Mq. Send (msg);

If 172.134.54.4 this server is directly externally accessible, the above code can send the message to the server's dedicated queue demo

5. How to penetrate firewalls, routing and other obstacles
Microsoft has a special article to explain this, mainly set up server-side c:windowssystem32msmqmappingsample_map.xml This file, details can see:
Http://www.microsoft.com/china/windowsserver2003/techinfo/overview/msmqb2b.mspx

Finally special thanks to my netizen Yongfeng, in the debugging process is he to give me a lot of help.

NOTE: Reprint please note the origin of the article

The Yang Over (http://blog.sqlsky.com/) arrangement under the Banyan Tree



</

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.