I'm receiving the following error when attempting to send/receive to an MSMQ queue using WCF:
"Creation of a message security context failed because the sender's SID was not found in the message. The message cannot be received. The WindowsDomain MsmqAuthenticationMode requires the sender's SID."
This is causing all messages to fail and therefore move to another poison queue. The error appears to be firing on the receiving service.
The client configuration is as follows:
<netMsmqBinding>
<binding name="OrderServiceMsmqBinding"
durable="true"
exactlyOnce="true"
maxReceivedMessageSize="2147483647"
maxRetryCycles="1"
receiveErrorHandling="Move"
receiveRetryCount="1"
retryCycleDelay="00:0:05"
deadLetterQueue="Custom"
customDeadLetterQueue="net.msmq://localhost/private/Services.DeadOrderListenerService/DeadOrderListenerService.svc"
useMsmqTracing="true">
<security mode="None" />
<readerQuotas maxStringContentLength="2147483647" />
</binding>
</netMsmqBinding>
as well as:
<client>
<endpoint address="net.msmq://localhost/private/Services.OrderPlacementProviderService/OrderPlacementProviderService.svc" binding="netMsmqBinding" bindingConfiguration="OrderServiceMsmqBinding" contract="Providers.IOrderPlacementService" name="orderingMsmqEndpoint" />
</client>
The receiving service is configured much the same:
<netMsmqBinding>
<binding name="OrderServiceMsmqBinding"
durable="true"
exactlyOnce="true"
maxReceivedMessageSize="2147483647"
maxRetryCycles="1"
receiveErrorHandling="Move"
receiveRetryCount="1"
retryCycleDelay="00:0:05"
deadLetterQueue="Custom" customDeadLetterQueue="net.msmq://localhost/private/Services.DeadOrderListenerService/DeadOrderListenerService.svc"
timeToLive="00:01:00"
useActiveDirectory="false"
useMsmqTracing="true">
<readerQuotas maxStringContentLength="2147483647" />
</binding>
</netMsmqBinding>
And:
<service name="Services.OrderPlacementProviderService" behaviorConfiguration="OrderServiceBehavior">
<endpoint address="mex" binding="mexHttpBinding" bindingConfiguration="" name="MexOrderService" contract="IMetadataExchange" />
<endpoint address="net.msmq://localhost/private/Services.OrderPlacementProviderService/OrderPlacementProviderService.svc" binding="netMsmqBinding" bindingConfiguration="OrderServiceMsmqBinding" contract="Providers.IOrderPlacementService" name="msmqEndpoint" />
<host>
<baseAddresses>
<add baseAddress="http://localhost/Services.OrderPlacementProviderService" />
</baseAddresses>
</host>
</service>
The queues are unauthenticated and have allowed access to Everyone for the time being. This SID issue has only just started occurring. It consistently occurs on different environments so I assume I've configured something wrongly?
Some more information: The client places an order (on the queue) like so:
using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required))
{
_orderPlacementClient.PlaceOrder(basket, transactionRef, user);
scope.Complete();
}
and the listening service looks like:
[OperationBehavior(TransactionScopeRequired = true, TransactionAutoComplete = true)]
public void PlaceOrder(BasketDTO basket, string transactionReference, UserDTO user)
{
_log.Info("Order placed: " + transactionReference + " for user " + user.Id);
try
{
_prov.PlaceOrder(basket, transactionReference, user);
}
catch (Exception ex)
{
_log.Error("Error placing order", ex);
}
}