This Connection string works well. you check your connection string similar to following example
Example: 1
Server=YourSystemName\SQLEXPRESS;Database=YourDb;Integrated Security=True;Trusted_Connection=True;TrustServerCertificate=True
Example: 2
Server=YourSqlInstance;Database=YourDb;Integrated Security=True;Trusted_Connection=True;TrustServerCertificate=True
Example: 3 (if in appsettings.json use double slash "\")
Server=YourSystemName\SQLEXPRESS;Database=YourDb;Integrated Security=True;Trusted_Connection=True;TrustServerCertificate=True