Wiki Link: [discussion:1620]
Enterprise Library LogEntry object and WCF MSMQIntegrationBinding Problem 

Apr 23 2009 at 8:21 AM
We have the following requirement in our project:

To create a client application in C# which uses the enterprise library 4.1 for logging information. For one of the logging catgeory, the log object is sent to private queue on a machine.
And instead of using the microsoft provided Distributor service to read the message from the queue, we need to have a WCF Service. On starting the service it should monitor the private queue and when a message arrives in the queue using the MSMQ Integration binding Service contract it should trigger a event in the application which reads the message from the queue and shows it on to the screen to the user.

Based on the example given in this article we have created the client application that logs information into the private queue using enterprise library and the WCF service.

Problem : The WCF service is able to read the message from the queue and display on the screen only when the client application logs the information in the queue directly without using Enterprise library.

MessageQueue queue = new MessageQueue(@"formatname:DIRECT=OS:.\private$\logqueue");
System.Messaging.Message msg = new System.Messaging.Message(logMessage, new BinaryMessageFormatter());
queue.Send(msg, MessageQueueTransactionType.Automatic);

If the message or information is logged to the queue using MSMQ trace listener of enterprise library then the WCF service tries to read the message from the queue, but does not trigger the event in the application and the message gets lost from the queue.

For logging the message in the queue we are using the Binary formator. Also one of the requirements for the queues is that it should be non-transactional.

Appricate your help in identifying how to make this work ...



Updating...
Page view tracker