masoud mazloum
masoud mazloum

Reputation: 99

Format of the initialization string does not conform to specification starting at index 0. in .NET 8

This is my connection string :

"ConnectionStrings": {
"EvSefDBConnection": "Server=.;Database=evsef_db;Trusted_Connection=True;MultipleActiveResultSets=true"

and this is my database setting:

builder
    .Services
    .AddDbContext<EvSefDbContext>(options => {
        options
            .UseSqlServer(
                builder
                    .Configuration
                    .GetConnectionString("EvSefDBConnection"));});

but after Add- migration , when I want to update , I see this error:

Format of the initialization string does not conform to specification starting at index 0.

Upvotes: 0

Views: 201

Answers (1)

masoud mazloum
masoud mazloum

Reputation: 99

I delete this code from context:

    protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
    {
        optionsBuilder.UseSqlServer("EvSefDBConnection");
    }

and edit connection string and add this :

TrustServerCertificate=True;

It works

Upvotes: 0

Related Questions