Enterprise Library Step by Step Series (14): Create an asynchronous log based on Message Queuing (MSMQ)
A Overview
As we said in the enterprise Library step through step series, the log and test application block consists of 2 parts: client and Distributor. The client is responsible for creating the messages that will be written to the target location by distributor. The client sends a message to distributor based on the distribution policy (distribution strategies), which provides 2 distribution policies in the Application Block: In process and MSMQ, by default in Process policy. The synchronization log is done in the client process, and the asynchronous log is implemented using MSMQ, and the client needs to create a log message and send it to the MSMQ message queue. Another process waits for the arrival of the message and writes the appropriate log sink application block containing a Windows SERVICE:MSMQ distributor Service. When the service is installed, the service detects Message Queuing at a specified interval. Let's take a look at the log and monitor application Block process flowchart:
Two Install and configure MSMQ Distributor Service1. Open the Visual Studio Command line tool and switch to the directory (the default Enterprise Library installation path) C:\Program Files\Microsoft Enterprise Library\bin, run the following command:
Installutil/imsmqdistributor.exe
Note: The service must be installed in this manner or the installation will not succeed. 2. A Setup Service logon dialog box pops up and requires a username and password to be entered. The form of the username and password must be entered as a domain user, in the form of <.\username>, as shown in the following illustration: