Troubleshooting Guide: SQL Server Error 11240 — Corrupted Message / Malformed Binary Preamble
Why This Error Happens
This error typically occurs when SQL Server’s Service Broker or Database Mirroring endpoint receives a TDS (Tabular Data Stream) message that has been corrupted in transit, often due to a network intermediary (firewall, load balancer, or proxy) interfering with the binary packet stream. It can also result from mismatched encryption/certificate configurations between endpoints, where one side expects an encrypted handshake preamble and the other sends plaintext, or from packet fragmentation caused by incorrect MTU settings on the network adapter. In some cases, a damaged or incompatible driver version communicating with SQL Server 2025 can also produce malformed preambles.
Step-by-Step Resolution Guide
Step 1: Verify Network Path Integrity
- Check for any hardware or software firewalls, proxies, or load balancers sitting between the SQL Server instances (common in mirroring/AG setups).
- Temporarily bypass intermediate network devices by testing a direct connection between the two servers to isolate whether packet manipulation is occurring.
- Run
Test-NetConnection -ComputerName <TargetServer> -Port <EndpointPort>in PowerShell to confirm the endpoint port is reachable and not being silently reset.
Step 2: Validate Endpoint Encryption Settings
- Open SQL Server Management Studio (SSMS) and run the following query to inspect endpoint encryption state:
SELECT name, protocol_desc, encryption_algorithm_desc
FROM sys.database_mirroring_endpoints;
- Ensure both the principal and mirror/witness servers have matching
ENCRYPTIONsettings (e.g., both set toREQUIREDor bothDISABLED) using:
ALTER ENDPOINT [Mirroring] STATE = STARTED
AS TCP (LISTENER_PORT = 5022)
FOR DATABASE_MIRRORING (ENCRYPTION = REQUIRED ALGORITHM AES);
- Confirm certificates used for endpoint authentication have not expired by checking
sys.certificates.
Step 3: Check Network Adapter MTU and Packet Fragmentation
- On Windows Server 2025, open PowerShell as Administrator and run
Get-NetIPInterfaceto review current MTU settings on the active NIC. - Standardize MTU size across all nodes (commonly 1500 for standard Ethernet) using:
Set-NetIPInterface -InterfaceAlias "Ethernet" -NlMtuBytes 1500
- Disable TCP Chimney Offload and Receive Side Scaling (RSS) temporarily to rule out NIC-level packet corruption:
Set-NetAdapterAdvancedProperty -Name "Ethernet" -DisplayName "Receive Side Scaling" -DisplayValue "Disabled"
Step 4: Update SQL Server Native Client and Drivers
- Navigate to
Control Panel > Programs > Programs and Featuresand confirm the version of the Microsoft OLE DB Driver or ODBC Driver being used by client applications. - Update to the latest driver compatible with SQL Server 2025 from the official Microsoft Download Center.
- Restart the SQL Server service via
services.mscor runRestart-Service MSSQLSERVERin PowerShell after the driver update completes.
Alternative or Verification Steps
- After applying fixes, re-run the mirroring or Service Broker session and monitor the SQL Server Error Log (
Management > SQL Server Logsin SSMS) for Error 11240 recurrence over a 24-hour period. - If the issue persists, capture a network trace using
netsh trace start capture=yesduring the failure window and analyze the TDS packet headers in Wireshark to pinpoint exactly where the preamble corruption is introduced.