Skip to content

Instantly share code, notes, and snippets.

@gabehesse
Created March 15, 2011 16:00
Show Gist options
  • Save gabehesse/870932 to your computer and use it in GitHub Desktop.
Save gabehesse/870932 to your computer and use it in GitHub Desktop.
Get the MSMQ messageid of the current operation when using WCF netmsmqbinding
MsmqMessageProperty msmqMessageProperty = (MsmqMessageProperty)OperationContext.Current.IncomingMessageProperties[MsmqMessageProperty.Name];
Type myType = typeof(MsmqMessageProperty);
PropertyInfo myPropInfo2 = myType.GetProperty("MessageId", BindingFlags.NonPublic | BindingFlags.Instance);
Console.WriteLine("Received message with MessageId: {0}", (string)myPropInfo2.GetValue(msmqMessageProperty, null));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment