Domanda

Perhaps it is obvious in MS world, apologies just in case. There are lots of references to this article: MSMQ, WCF and IIS: getting them to play nicely (part 1 of 3).

What I am struggling with is that the only method in service contract is SendMessage. And implementation of this method is on service side, while I would expect client to be sending messages, and service receiving them via listener. Does this mean that SendMesage method will be called by IIS/WAS/Net.MsmqListener(?) as soon as it discovers a message in a queue defined by endpoint?

And if so then message is passed as as string and not as object of System.Messaging.Message

public void SendMessage(string message)

The way I am "sending" message to this queue from my client is roughly like this:

 Message m = new Message();
 m.Recoverable = true;
 m.Body = myxmlargs.ToString();
 MessageQueue q = getQueue();
 q.Send(m);
È stato utile?

Soluzione

I got my implementation working and here's what I learned along the way:

  • since name of service is defined in the contract, client implementation sends it and server should implement actions upon receiving. It's just the WCF paradigm.
  • it was wrong to use manual method sending message to the queue, server side does not recognize it as valid input. Letting contract do its job does the trick.
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top