Troubleshooting Guide: SQL Server Error 13119 (Endpoint Issue)
Why This Error Happens
Error 13119 in Microsoft SQL Server 2025 typically occurs when the Service Broker or Database Mirroring endpoint cannot be created, started, or validated because the specified port is already bound to another process or endpoint. This can also result from a mismatch in endpoint state (STARTED, STOPPED, DISABLED) during a configuration change, or from insufficient permissions on the endpoint object itself. In some cases, a corrupted or orphaned endpoint entry in sys.endpoints left over from a failed previous configuration can trigger this error when Windows Server 2025 attempts to re-initialize the TCP listener.
Step-by-Step Resolution Guide
Step 1: Verify Port Availability and Conflicts
- Open an elevated Command Prompt on Windows Server 2025 / Windows 11 and run
netstat -ano | findstr <port_number>(commonly 5022 for mirroring or 4022 for Service Broker). - Identify the PID using the port and cross-reference it in Task Manager to confirm it is not another SQL Server instance or conflicting service.
- If a conflict exists, either stop the conflicting process or reassign the endpoint to an unused port using
ALTER ENDPOINT.
Step 2: Inspect and Reset the Endpoint Configuration
- Connect via SQL Server Management Studio (SSMS) and query existing endpoints:
SELECT name, protocol, type, state_desc FROM sys.endpoints;- If the endpoint is in a corrupted or inconsistent state, drop and recreate it:
DROP ENDPOINT [Mirroring_Endpoint];CREATE ENDPOINT [Mirroring_Endpoint] STATE = STARTED AS TCP (LISTENER_PORT = 5022) FOR DATABASE_MIRRORING (ROLE = ALL);
Step 3: Validate Permissions and Firewall Rules
- Ensure the SQL Server service account has
CONNECTpermission on the endpoint:GRANT CONNECT ON ENDPOINT::[Mirroring_Endpoint] TO [DOMAIN\ServiceAccount]; - Check Windows Defender Firewall on Windows Server 2025 to confirm the required port is allowed via
New-NetFirewallRule -DisplayName "SQL Endpoint" -Direction Inbound -Protocol TCP -LocalPort 5022 -Action Allow. - Restart the SQL Server service (
services.mscorRestart-Service MSSQLSERVER) to apply changes.
Step 4: Review SQL Server Error Logs
- Open the SQL Server Error Log via SSMS (Management > SQL Server Logs) or the file path
C:\Program Files\Microsoft SQL Server\MSSQL17.MSSQLSERVER\MSSQL\Log\ERRORLOG. - Search for additional context lines immediately preceding Error 13119 to confirm whether it is a port, permission, or state-related trigger.
Alternative or Verification Steps
- Confirm the fix by querying
SELECT state_desc FROM sys.endpoints WHERE name = 'Mirroring_Endpoint';— it should returnSTARTEDwithout errors. - If the issue persists, use
sp_helpserverandDBCC CHECKDBon msdb to rule out metadata corruption, or fully uninstall/reinstall the Service Broker/Mirroring feature component via SQL Server Configuration Manager.