title: Database mirroring and service broker, The mirror route is not operational
body: <p>We have had a service broker running for quite some time (running on the same server). Now we want to add database mirroring between two servers.</p>
  
  <p>For this to work we had to create new routes and new endpoints for the service broker (to support mirroring in case of a failover).</p>
  
  <p>We have tried this in a development environment running the exact same version of windows and sql-server. Which is:</p>
  
  <p>Microsoft SQL Server 2008 R2 (RTM) - 10.50.1734.0 (X64)   Aug 11 2010 12:51:02   Copyright (c) Microsoft Corporation  Enterprise Edition (64-bit) on Windows NT 6.1  (Build 7600: )</p>
  
  <p>One difference is that the development environment is running in a virtual system.</p>
  
  <p>When we implemented this in our production environment we got problems that we never saw in the development envornment.</p>
  
  <p>The service broker updates became really slow, but we could see that some of the messages came through.</p>
  
  <p>The error message that we get is:</p>
  
  <p>The mirror route <strong>is not operational</strong>. 'TCP://server1.domain.local:4022' is acting as <strong>'Unknown'</strong> []. 'TCP://server2.domain.local:4022' is acting as <strong>'Unknown'</strong> [].</p>
  
  <p>The mirror route is operational, but only connected to principal. 'TCP://server1.domain.local:4022' is acting as 'Principal' []. 'TCP://server2.domain.local:4022' is acting as 'Unknown' [].</p>
  
  <p>On our development servers we got a similar message:</p>
  
  <p>The mirror route <strong>is operational</strong>. 'TCP://server1.devdomain.local:4022' is acting as <strong>'Mirror'</strong> []. 'TCP://server2.devdomain.local:4022' is acting as <strong>'Principal'</strong> [].</p>
  
  <p>The mirror route is operational, but only connected to principal. 'TCP://server1.devdomain.local:4022' is acting as 'Unknown' []. 'TCP://server2.devdomain.local:4022' is acting as 'Principal' [].</p>
  
  <p>As you can see we get messages about that the mirror route is not operational on our production servers, but not on our development servers.</p>
  
  <p>The database mirroring is setup over port 5022, and service broker for 4022.</p>
  
  <p>Some example of how routes/endpoints were created:</p>
  
  <pre><code>--created on booth principal and mirror
  CREATE ENDPOINT [Mirroring] 
      AUTHORIZATION [domain\sqlservice]
      STATE=STARTED
      AS TCP (LISTENER_PORT = 5022, LISTENER_IP = ALL)
      FOR DATA_MIRRORING (ROLE = PARTNER, AUTHENTICATION = WINDOWS NEGOTIATE, ENCRYPTION = DISABLED)
  
  --created on booth principal and mirror
  CREATE ENDPOINT [BrokerEndpoint] 
      AUTHORIZATION [domain\sqlservice]
      STATE=STARTED
      AS TCP (LISTENER_PORT = 4022, LISTENER_IP = ALL)
      FOR SERVICE_BROKER (MESSAGE_FORWARDING = DISABLED, MESSAGE_FORWARD_SIZE = 10, AUTHENTICATION = WINDOWS NEGOTIATE, ENCRYPTION = DISABLED)
  
  --created in DB1 (on principal)
  CREATE ROUTE [RouteToDB2]  AUTHORIZATION [dbo]  WITH SERVICE_NAME = N'ExecSPReceiveService' , BROKER_INSTANCE = N'DF46452B-97F3-4924-AD2A-A130FDC2016F' , ADDRESS = N'TCP://server1.domain.local:4022' , MIRROR_ADDRESS = N'TCP://server2.domain.local:4022' 
  
  --created in DB2 (on principal)
  CREATE ROUTE [RouteToDB1]  AUTHORIZATION [dbo]  WITH SERVICE_NAME = N'ExecSPSendService' , BROKER_INSTANCE = N'91CBA730-48A2-47A8-95C8-0558706250AB' , ADDRESS = N'TCP://server1.domain.local:4022' , MIRROR_ADDRESS = N'TCP://server2.domain.local:4022' 
  </code></pre>
  
  <p>When we remove the database mirroring endpoint everything starts to work normal again.</p>
  
  <p>Any ideas?</p>
  
  <p>Thanks!</p>