Why Am I Getting:"Option 'Single_User' Cannot Be Set in Database 'Master'." When Running My Backend C#?

When I'm trying to run my backend application in C# that allows users to login and register accounts I'm getting the following error:

 Microsoft.EntityFrameworkCore.Database.Command: Error: Failed executing DbCommand (3ms) [Parameters=[], CommandType='Text', CommandTimeout='60']
    IF SERVERPROPERTY('EngineEdition') <> 5
    BEGIN
        ALTER DATABASE [master] SET SINGLE_USER WITH ROLLBACK IMMEDIATE;
    END;
    fail: Microsoft.EntityFrameworkCore.Database.Command[20102]
          Failed executing DbCommand (3ms) [Parameters=[], CommandType='Text', CommandTimeout='60']
          IF SERVERPROPERTY('EngineEdition') <> 5
          BEGIN
              ALTER DATABASE [master] SET SINGLE_USER WITH ROLLBACK IMMEDIATE;
          END;
    Exception thrown: 'Microsoft.Data.SqlClient.SqlException' in Microsoft.EntityFrameworkCore.Relational.dll
    Exception thrown: 'System.AggregateException' in System.Private.CoreLib.dll
1
Sophia Al-Mansoor

Sophia Al-Mansoor

Global Business & E-Commerce Reporter

Sophia analyzes international trade, startup ecosystems, retail transformation, and supply chain logistics for modern digital publications.

Share this article