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

Why This Error Happens

Error 12325 occurs when an application attempts to use a bound transaction (via sp_bindsession) in combination with a feature or driver that does not support session binding, such as certain connection pooling configurations, MARS (Multiple Active Result Sets), or distributed transaction coordination under newer SQL Server engine restrictions. In SQL Server 2025, bound transactions are increasingly deprecated in favor of distributed transaction APIs, so legacy code calling sp_bindsession or sp_getbindtoken against restricted connection types triggers this failure. This is typically a code/configuration-level conflict rather than a corruption issue, often surfacing after an OS or SQL Server version upgrade.

Step-by-Step Resolution Guide

Step 1: Identify the Source of the Bound Transaction Call

  • Review application connection strings and ADO.NET/ODBC driver settings for sp_bindsession or sp_getbindtoken usage.
  • Check application logs for the exact stored procedure or .NET method invoking session binding.
  • Search source code for SqlConnection.TransactionBinding or legacy COM+ transaction binding calls.

Step 2: Disable Incompatible Connection Features

  • Open the application’s connection string and ensure MultipleActiveResultSets=False if MARS is enabled, since MARS connections cannot be bound.
  • In SQL Server Management Studio (SSMS), verify the connection is not using connection pooling in a way that reuses sessions improperly — set Pooling=False temporarily to test.
  • Navigate to C:\Program Files\Microsoft SQL Server\160\Tools\Binn\ (or your 2025 installation path) and confirm you’re using the latest sqlncli or Microsoft.Data.SqlClient driver version, which has updated binding rules.

Step 3: Replace Bound Transactions with Distributed Transaction Coordinator (DTC)

  • Modify application code to use System.Transactions.TransactionScope instead of manual sp_bindsession calls.
  • On Windows Server 2025 / Windows 11, open Component Services (dcomcnfg.exe) and ensure Distributed Transaction Coordinator service is running under Computers > My Computer > Distributed Transaction Coordinator > Local DTC.
  • Set DTC Security Configuration to allow Network DTC Access, Allow Inbound/Outbound, and No Authentication Required (or Mutual Authentication if domain-joined) to support cross-session transaction coordination.

Step 4: Update SQL Server Configuration and Drivers

  • Run Windows Update and SQL Server Cumulative Update tool to ensure SQL Server 2025 is fully patched.
  • Use sqlcmd -S <ServerName> -Q "SELECT @@VERSION" to confirm build number matches the latest CU.
  • Restart the SQL Server service via services.msc after updates to apply binding-related engine fixes.

Alternative or Verification Steps

  • Run a test transaction using BEGIN DISTRIBUTED TRANSACTION in SSMS against the affected database to confirm Error 12325 no longer appears.
  • If the error persists, bypass bound transactions entirely by refactoring the application to use independent connections per transaction scope rather than sharing a session token across connections.