This package is an unofficial port of the .NET Framework System.Messaging assembly for .NET Core/.NET 8+ applications running on Windows. It is provided for development convenience. If Microsoft officially releases an MSMQ client package, you should migrate to the official package. The source code for this package is derived from the .NET Framework reference source code.
$ dotnet add package Experimental.System.MessagingExperimental port of System.Messaging (for .NET Core)
This package is an unofficial port of the .NET Framework System.Messaging assembly for .NET Core/.NET 8+ applications running on Windows. It is provided for development convenience. If Microsoft officially releases an MSMQ client package, you should migrate to the official package.
The source code for this package is derived from the .NET Framework reference source code.
This project is licensed under the Microsoft Reciprocal License (Ms-RL).
The original source code was obtained from Microsoft Reference Source (referencesource.microsoft.com) when it was available under the Ms-RL license. Due to insufficient understanding at the time, this package was mistakenly distributed under the MIT License from its initial release until version 1.1.0. We sincerely apologize for this error and have corrected the license to Ms-RL starting from version 1.2.0.
As a derivative work based on Ms-RL licensed code, this package must also be distributed under Ms-RL in accordance with the license terms.
This source code is based on Microsoft's Reference Source, but may contain differences from the original. Bug fixes have been applied in the public interest based on community-reported issues. If Microsoft officially releases an MSMQ client package for .NET Core/.NET 5+, that official package should take priority over this experimental package. Users are encouraged to migrate to the official package when it becomes available.
The MessageQueue constructor accepts various path formats. Below are common formats you can use:
// Local private queue
var queue = new MessageQueue(@".\Private$\MyQueue");
// Local private queue using machine name
var queue = new MessageQueue(@"MachineName\Private$\MyQueue");To connect to remote queues, use the direct format name syntax:
// Using TCP (recommended for remote queues)
var queue = new MessageQueue(@"FormatName:Direct=TCP:192.168.1.100\Private$\MyQueue");
// Using OS (uses Windows networking)
var queue = new MessageQueue(@"FormatName:Direct=OS:RemoteMachineName\Private$\MyQueue");
// Using HTTP (requires MSMQ HTTP support)
var queue = new MessageQueue(@"FormatName:Direct=HTTP://hostname/msmq/Private$/MyQueue");
// Using HTTPS
var queue = new MessageQueue(@"FormatName:Direct=HTTPS://hostname/msmq/Private$/MyQueue");| Protocol | Format | Example |
|---|---|---|
| TCP | FormatName:Direct=TCP:address\queue | FormatName:Direct=TCP:192.168.1.100\Private$\MyQueue |
| OS | FormatName:Direct=OS:machine\queue | FormatName:Direct=OS:Server01\Private$\MyQueue |
| HTTP | FormatName:Direct=HTTP://host/msmq/queue | FormatName:Direct=HTTP://server/msmq/Private$/MyQueue |
| HTTPS | FormatName:Direct=HTTPS://host/msmq/queue | FormatName:Direct=HTTPS://server/msmq/Private$/MyQueue |
// Local public queue
var queue = new MessageQueue(@"MachineName\MyPublicQueue");
// Remote public queue using format name
var queue = new MessageQueue(@"FormatName:Direct=TCP:192.168.1.100\MyPublicQueue");TCP: without bracketsPrivate$ in the pathDirect format bypasses Active Directory lookup, making it suitable for workgroup environments.csproj) and updated targeting to net8.0, adjusted CI/build workflow and test project compatibility, and made minor documentation edits.netstandard2.0 to net8.0. Since MSMQ is a Windows-only technology, the original cross-platform targeting via .NET Standard was unnecessary. Mono has transitioned to WineHQ, .NET Framework already has native System.Messaging support, and other platforms (Silverlight, UWP, Unity) are not applicable targets for this library.AccessControlEntry, AccessControlEntryType, AccessControlList, MessageQueueAccessControlEntry, MessageQueuePermission, MessageQueuePermissionAccess, MessageQueuePermissionEntry, and MessageQueuePermissionEntryCollection classes. (PR #5, contributed by @j0hnth0m)StringToBytes method. This bug affected MessageQueue.Label, MessageQueue.MulticastAddress, Message.Label, Message.AuthenticationProviderName, and queue format name properties.Trustee class namespace from System.Messaging to Experimental.System.Messaging.