0

I'm trying to connect to the local database instance that visual studios provides, I setup a connection string in the appsettings.json however, it keeps failing at the integrated security keyword, it says it doesn't exist. However if I take it out, the response gets a timeout because there was no pre-authorization handshake which is because I set my dbcontext to identitydbcontext so I would need to specify the integrated security = true keyword but alas I'm stuck

This is the default connection string:

"DefaultConnection":"Server=(localdb)\\\\
mssqllocaldb;Database=ChatAppTr;MultipleActiveResultSets=true;
Integrated Security=True;"

This is how I setup the database context for my web app:

///Specify what type of user you want in identity context:
public class AppDbContext : IdentityDbContext<User>
{
    public AppDbContext(DbContextOptions<AppDbContext> options) :
        base( options){ }
        /// Registers models to AppdbContext
        public DbSet<Chat> Chats { get; set; }
        public DbSet<Messages> Messages { get; set; }
    }
}

I expected it to just connect to the localdb instance but nothing happened.

Toni
  • 1,555
  • 4
  • 15
  • 23
Darman
  • 175
  • 10
  • Did you set your connection to Context in Startup.cs? Like this: `services.AddDbContext(options => options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection")));` – Selim Yildiz Sep 08 '19 at 12:30
  • this link: https://stackoverflow.com/questions/39083372/how-to-read-connection-string-in-net-core – Mojtaba Nava Sep 08 '19 at 12:36
  • Yeah i set that all up, i'm not sure i think theres something in the connection string. What my idea is its to connect to a local instance of db (not the sql server one) @SelimYıldız – Darman Sep 08 '19 at 12:37
  • I don't have problems with the configuration i understand the whole adding to services bit and selecting options all of that. It just i dont get how i used to connect to the local instance? @MojtabaNava – Darman Sep 08 '19 at 12:39

0 Answers0