Questions tagged [msmq-wcf]

WCF can communicate directly with MSMQ, whether you intend to read/write from/to MSMQ. WCF also allows the plug-in of MSMQ-like COM/COM+ components.

MSMQ is a Windows platform specific technology to guarantee the delivery of messages to a specific destination. WCF has 2 bindings which can read/write directly to/from MSMQ, without the need for specific code - just configuration.

WCF offers 2 binding strategies:

  • NetMsmqBinding - a push/pull directly to/from MSMQ
  • MsmqIntegrationBinding - a push/pull directly from a COM/COM+ component

To use MSMQ and WCF together is actually very straight forward. From inserting into MSMQ, you do not even need a concrete implementation on the WCF. A simple example would be:

namespace WcfServices
{
  // Interface is only required for MSMQ
  [ServiceContract]
  public interface ISendTextService
  {
    [OperationContract(IsOneWay=true)]
    public void Write(string text);
  }
}

To hook this up to a configuration file you would do:

<configuration>
  <system.serivceModel>
     <bindings>
       <netMsmqBinding>
         <!-- exactlyOnce="false" allows you send multiple MSMQ messages from the channel instance -->
         <binding exactlyOnce="false">

           <!-- Remove security requirements for testing -->
           <security mode="None"/>
         </binding>           
     </bindings>
     <client>
       <!-- Address format requires net.msmq prefix and no $ sign -->
       <!-- The MSMQ 'test' must also already exist for this to work -->
       <endpoint address="net.msmq://localhost/private/test"
                 binding="netMsmqBinding"
                 contract="WcfService.ISendTextService" />    
     </client>
   </system.serviceModel>
 </configuration>

This deals with the sending to MSMQ. A client app can then do something like:

public class TestMsmq
{
  static void Main(string[] args)
  {
     var factory = new ChannelFactory<WcfService.ISendTextService>();
     var channel = factory.CreateChannel();

     // This is required so that they can all be committed together
     using(var scope = new TransactionScope(TransactionScopeOption.Required))
     {
        channel.SendText("Hello, world!");
        channel.SendText("Hello, world! - Part 2");
        channel.SendText("Hello, world! - Part 3");
        scope.Complete();
     }
  }
}
55 questions
0
votes
2 answers

How to consume MSMQ service

I want to consume msmq service. But unable to send message to queue. Here is my code. System.Messaging.MessageQueue msmQ = new System.Messaging.MessageQueue("net.msmq://myServerName/private/MyQueueName"); msg…
Sanket
  • 83
  • 7
0
votes
1 answer

MSMQ Message Multicast: Unable to receive messages on different machine

I want to create Publisher and Subscriber Model using MSMQ Multicast feature. I have already followed the answer in the link without success MSMQ - Cannot receive from Multicast queues Messages getting sent and received in local…
Rajesh Mishra
  • 436
  • 5
  • 15
0
votes
3 answers

An error occurred while sending to the queue: Unrecognized error -1072824273 (0xc00e002f).Ensure that MSMQ is installed and running

Hi got the message below when sending an message to a remote queue. An error occurred while sending to the queue: Unrecognized error -1072824273 (0xc00e002f).Ensure that MSMQ is installed and running. If you are sending to a local queue, ensure the…
MiguelSlv
  • 14,067
  • 15
  • 102
  • 169
0
votes
1 answer

WCF Service Not Reading Messages in Queue

I have a WCF service that reads from a message queue. I noticed with our latest deployment that there is a message sitting in the queue that has not been read. The WCF service is up and running and it is correctly establishing a connection to the…
Travis Parks
  • 8,435
  • 12
  • 52
  • 85
0
votes
1 answer

How to create a WCF dead-letter service for MSMQ3.0

I'm trying to create a service reading the dead-letter from the transactional system dead letter queue. The service configuration looks like this:
Enyra
  • 17,542
  • 12
  • 35
  • 44
0
votes
1 answer

MSMQ and Unity.Wcf - Service never consumes the queue

Has anyone ever managed to implement MSMQ over WCF using a Unity container? My server starts up, creates the private queue and exposes the mex. My client can resolve the service reference, connect, and successfully write messages to the queue. The…
Jan
  • 2,747
  • 27
  • 35
0
votes
1 answer

Slow Response Time when sending event data to another form

I have a C# winform application that has 4 distinct user controls on the screen. Each of these user controls contains a datagridview control. When the user updates a cell value in any one of these 4 control I raise a custom event sending the value…
Rick
  • 648
  • 1
  • 11
  • 25
0
votes
1 answer

msmq unsupported format name operation although the format names are correct

I am debugging though a wcf service. I have a service attached and debugging along with the exe. During the process, I get unsupported format name operation error when initializing queues with strings. However, I am pretty sure and double checked…
user2751691
  • 401
  • 2
  • 10
  • 32
0
votes
1 answer

How to recover deleted system files in MSMQ

I Unfortunatly deleted the System Files of MSMQ under, C:\Windows\System32\msmq\storage\lqs now i unable to send and receive messages from Queue. How to recover the deleted files?
Vishnu
  • 1,029
  • 4
  • 14
  • 24
0
votes
1 answer

Long running WCF MSMQ Processing

I am reading Programming WCF Services 3rd Ed. by Juval Lowy. In the chapter "Queued Services" which covers NetMsmqBinding, On page 473, he says "... you should keep the service's processing of the queued call relatively short, or risk aborting the…
Phillip Scott Givens
  • 5,256
  • 4
  • 32
  • 54
1 2 3
4