This sample shows how to send a MSMQ message from a Windows Forms client that contains a object instance serialized using XML. The messages are received and processed by a Windows Service.
This sample has three components that work together:
Class Library
The class library, server.dll, exposes a single public class named MSMQOrders. It has 3 public fields and a method named process.
Requires the Trial or Release version of Visual Studio .NET Professional (or greater). In addition you will need a machine that has a valid installation of MSMQ installed.
Before you can run the sample three things must be done:
Creating the queue varies depending upon the version of MSMQ installed. The application expects for find a private, non-transactional queue named Orders. Note you can change the queue that is expected by modifying both the client and service's configuration files.
Installing the service requires the use of a command-line tool, InstallUtil.exe, which comes with the .NET Framework SDK. To install the service do the following:
The service is configured to require MSMQ. You will need to start the service. You can do it from a command prompt by typing:
Or you can use the Windows Services MMC. To uninstall the service stop it and type the following at a Visual Studio .NET command prompt:
Note that if you decide to move the service to some other directory, you must copy the Server.dll file with it.
Once you have the service installed, run the client and send messages.