I'm using msmqIntegrationBinding to send messages to a legacy MSMQ. I want to be able to use the same config file in preprod as we do in production, but in preprod the legacy queue is local whereas the production queue is on another server.
I thought I could do it with a DNS alias.
I've set up a DNS alias in the HOSTS file on my preprod server to 127.0.0.1
127.0.0.1 CRM_SERVER
I've configured the endpoint in the client to use a DIRECT OS formatname using the DNS alias
<endpoint name="LegacyMsmqService"
address="msmq.formatname:DIRECT=OS:CRM_SERVER\crmintegration"
binding="msmqIntegrationBinding"
contract="Integration.Facades.ILegacyMsmqService"
bindingConfiguration="msmqIntegrationBinding"/>
I've set the HKEY_LOCAL_MACHINE\Software\Microsoft\MSMQ\Parameters\IgnoreOSNameValidation
registry key to 1, and I've even add CRM_SERVER
to the HKEY_Local_Machine\System\CurrentControlSet\Services\LanmanServer\Parameters\OptionalNames
key.
I've restarted at least a dozen times!
Whenever my client sends a message to the queue, it's ending up on an Outgoing Queue, not on the local queue. Using the correct machine name or localhost works fine.
Have I missed something?
To resolve via DNS use the DNS name rather than the IP this way:
As you noted in your question, it is important to set the IgnoreOSNameValidation paramater on MSMQ client (your preprod machine is both client and server) (per http://support.microsoft.com/kb/306785). Here is a command line way to do that:
or if you prefer, by powershell:
NOTE: inserting into QUEUE entries can resolve using TCP protocol in the format name instead--but for reading from the queue you cannot use TCP (recall the MSMQ is old tech):