I have a local private queue. I also have a WCF-service inside an MVC-application that listens to the queue using msmqIntegrationBinding. The problem is that the service contract is never invoked when a message is queued but the message disapears the moment after. The message is not in the poison queue. Here is the config-part where i declare the binding to the queue:
<services>
<service name="SkruvInfo.Web.Service.QueueMessageReceiver">
<endpoint address="msmq.formatname:DIRECT=OS:LEIA\private$\screwinfo_autotests_messagequeue"
binding="msmqIntegrationBinding"
bindingConfiguration="MsmqBinding"
contract="SkruvInfo.Web.Service.IQueueMessageReceiver" />
</service>
</services>
And here is the contract:
[ServiceContract(Namespace = "http://localhost/SkruvWeb/Service")]
public interface IQueueMessageReceiver
{
[OperationContract(IsOneWay = true, Action = "*")]
void PutScrewInfoMessage(MsmqMessage<string> msg);
}
And here is the method in the service:
[OperationBehavior(TransactionScopeRequired = true, TransactionAutoComplete = true)]
public void PutScrewInfoMessage(System.ServiceModel.MsmqIntegration.MsmqMessage<string> msg)
{
log4net.Config.XmlConfigurator.Configure();
var log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
try
{
log.Debug("Message from queue: " + msg.Body.ToString(CultureInfo.InvariantCulture));
var xDoc = new XmlDocument();
xDoc.LoadXml(msg.Body);
CacheScrewInfoModelFromScrewInfoXmlDoc(xDoc);
}
catch (Exception e)
{
log.Error("Error parsing message from queue",e);
EventLog.WriteEntry("Application","Message error for screws");
}
}
Any suggestions to why the message disapears but does not invoke the service?
Try to modify your service contract with ServiceKnownType attribute:
UPDATE
If you are using MsmqIntegrationBinding I am assuming your queue client is a legacy application like a VB6 client? If so you will need to specify the serialization format in your service binding configuration. For example:
Permissable values are documented here.