How to fix Error 13206 on Windows Server 2025 / Windows 11

Why This Error Happens

Error 13206 in SQL Server’s Service Broker subsystem typically occurs when a CREATE SERVICE or ALTER SERVICE statement references a CONTRACT that either does not exist in the current database scope, has been dropped while still referenced by an active queue, or the executing login lacks the REFERENCES permission on that specific contract object. This is common after database migrations to SQL Server 2025, where Service Broker GUIDs can become orphaned or mismatched between the publisher and subscriber databases. In some cases, this is also triggered by a corrupted sys.service_contracts system catalog entry following an improper failover on Windows Server 2025 clusters.

Step-by-Step Resolution Guide

Step 1: Verify Contract Existence and Permissions

  • Open SQL Server Management Studio (SSMS) and connect to the affected instance.
  • Run the following query to confirm the contract is actually registered in the database: SELECT name, contract_id FROM sys.service_contracts;
  • If the contract is missing, you must recreate it using the original CREATE CONTRACT script before the dependent service can be created.
  • Grant explicit permissions if the contract exists but the error persists: GRANT REFERENCES ON CONTRACT::[YourContractName] TO [YourServiceAccount];

Step 2: Check for GUID Mismatches in Service Broker

  • Since this often relates to broken Broker IDs post-migration, verify the Service Broker GUID matches the database ID: SELECT is_broker_enabled, service_broker_guid FROM sys.databases WHERE name = 'YourDBName';
  • If the GUID is NULL or mismatched due to a restore operation, run: ALTER DATABASE [YourDBName] SET NEW_BROKER WITH ROLLBACK IMMEDIATE;
  • Note: Only use NEW_BROKER if you do not need to preserve existing conversation handles, as this action clears the message queue.

Step 3: Restart the SQL Server Service and Broker

  • Open the Services console (services.msc) on your Windows Server 2025/Windows 11 machine.
  • Locate SQL Server (MSSQLSERVER) or your specific named instance.
  • Right-click and select Restart to force the Service Broker to re-initialize its internal routing tables.
  • Alternatively, run this T-SQL command to toggle the broker without a full service restart: ALTER DATABASE [YourDBName] SET ENABLE_BROKER;

Step 4: Rebuild the Service Definition

  • If the contract and permissions are correct but the error remains, drop and recreate the specific SERVICE that failed.
  • Execute: DROP SERVICE [YourServiceName]; followed by CREATE SERVICE [YourServiceName] ON QUEUE [YourQueueName] ([YourContractName]);
  • Ensure the Queue is in a STATUS = ON state before attempting to bind the service to it again.

Alternative or Verification Steps

  • To verify the fix, send a test message using BEGIN DIALOG between the two services and check sys.transmission_queue for any lingering error descriptions; an empty result set confirms successful routing.
  • If the error persists after rebuilding the service, check the SQL Server Error Log via SSMS (Management > SQL Server Logs) for a corresponding Broker Manager startup failure, which may indicate a deeper master key encryption issue requiring a MASTER KEY restoration.