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

Troubleshooting Guide: SQL Server Debugger Connection Failure (Error 504)

Why This Error Happens

This error occurs when SQL Server 2025’s T-SQL debugger component cannot establish a connection to the client-side debugging interface, typically due to the Windows Firewall blocking the required DCOM and debugger ports on Windows Server 2025 or Windows 11. It can also stem from missing or corrupted client-side debugging components (such as sqlservr.exe companion DLLs) or insufficient permissions on the SQL Server Debugging DCOM launch and activation rights. Additionally, a mismatch between the SQL Server Management Studio (SSMS) version and the SQL Server 2025 engine can prevent the debugger handshake from completing.

Step-by-Step Resolution Guide

Step 1: Verify and Configure DCOM Permissions

  • Open Component Services via dcomcnfg.exe on the machine running SQL Server.
  • Navigate to Component Services > Computers > My Computer > DCOM Config, locate SQL Debugging.
  • Right-click, select Properties > Security, and grant Local Launch, Remote Launch, Local Activation, and Remote Activation permissions to the user account running the debugger.
  • Restart the DCOM Server Process Launcher service if changes do not apply immediately.

Step 2: Open Required Firewall Ports

  • Ensure TCP port 135 (RPC endpoint mapper) is open on both client and server machines.
  • Run this command in an elevated PowerShell session to allow the port:
  • New-NetFirewallRule -DisplayName "SQL Debugger RPC" -Direction Inbound -Protocol TCP -LocalPort 135 -Action Allow
  • Confirm that dynamic RPC ports (typically in the range 49152-65535) are not being blocked by a third-party security suite.

Step 3: Repair or Reinstall Client-Side Debugging Components

  • Launch the SQL Server 2025 installation media and select Repair from the setup wizard.
  • Ensure the SQL Server Debugging Extensions feature is checked during the repair process.
  • Alternatively, uninstall and reinstall SQL Server Management Studio (SSMS) to refresh the debugger client DLLs.

Step 4: Confirm Version and Authentication Compatibility

  • Verify that SSMS and SQL Server 2025 Engine builds match by checking Help > About in SSMS against the SQL Server version output from SELECT @@VERSION.
  • Ensure Windows Authentication is used for the debugging session, as SQL Authentication does not support T-SQL debugging in most configurations.
  • Confirm the login account is a member of the sysadmin server role or has been granted the ALTER ANY EVENT SESSION permission where applicable.

Alternative or Verification Steps

  • To verify the fix, open a new query window in SSMS, set a breakpoint, and select Debug > Start Debugging (Alt+F5); a successful connection will display the local variables and call stack windows without throwing Error 504.
  • If the issue persists, run SSMS and SQL Server as Administrator on both ends, or use Process Monitor to trace Access Denied events during the debugger initialization phase.