Dedicated Administrator Connection (DAC) for SQL Server Express Edition

If you try to login using Dedicated Administrator Connection (DAC) to SQL Server Express edition using sqlcmd:

sqlcmd -A -d master -S localhost\SQLEXPRESS

...you may get an error similar to this:

HResult 0x274D, Level 16, State 1
TCP Provider: No connection could be made because the target machine actively refused it.
Sqlcmd: Error: Microsoft SQL Server Native Client 10.0 : A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online..
Sqlcmd: Error: Microsoft SQL Server Native Client 10.0 : Login timeout expired.

Using Database Engine Query, in SQL Server Management Studio the error may be similar to this:

(provider: TCP Provider, error: 0 - No connection could be made because the target machine actively refused it.) (Microsoft SQL Server, Error: 10061)

By default, SQL Server Express does not listen on the DAC port to conserve resources. To enable DAC on SQL Server Express, you need to start SQL Server Express service with TRACE FLAG -T7806.

Right-click on the SQL Server service using Configuration Manager, select Properties and the Advanced tab, and add Trace Flag:
;-T7806
to the Startup Parameters entry.

You will be required to restart your SQL Server service for this configuration change to take effect.

Read previous blog post about How to enable and disable trace flags, or check for active trace flags in SQL Server:
How to enable and disable trace flags, or check for active trace flags in SQL Server

SQL Server Browser service must be running to connect to Dedicated administrator connection (DAC).
It is possible to make only one connection at a time with DAC.
Now if you try to connect to SQL Server Express edition using DAC, the connection will succeed.

See detailed explanation how to connect to SQL Server using DAC in a previous article:
“Dedicated administrator connections are not supported” message in SQL Server