title: Entity Framework Core not working with Windows Authentication
body: <p>Whenever I try to connect to the database I get this exception</p>
  
  <pre><code>Unhandled Exception: System.Data.SqlClient.SqlException: Cannot open database "TrackTvDb" requested by the login. The login failed.
  Login failed for user 'DESKTOP-MTHC289\hristo.kolev'.
     at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData, Boolean applyTransientFaultHandling)
     at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions)
     at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool pool, DbConnection owningObject, DbConnectionOptions options, DbConnectionPoolKey poolKey, DbConnectionOptions userOptions)
     at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)
     at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)
     at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal&amp; connection)
     at System.Data.ProviderBase.DbConnectionPool.WaitForPendingOpen()
  --- End of stack trace from previous location where exception was thrown ---
     at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
     at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
     at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.&lt;OpenAsync&gt;d__31.MoveNext()
  --- End of stack trace from previous location where exception was thrown ---
     at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
     at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
     at Microsoft.EntityFrameworkCore.Query.Internal.AsyncQueryingEnumerable.AsyncEnumerator.&lt;MoveNext&gt;d__8.MoveNext()
  --- End of stack trace from previous location where exception was thrown ---
     at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
     at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
     at Microsoft.EntityFrameworkCore.Query.AsyncQueryMethodProvider.&lt;GetResult&gt;d__16`1.MoveNext()
  --- End of stack trace from previous location where exception was thrown ---
     at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
     at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
     at Microsoft.EntityFrameworkCore.Query.Internal.TaskResultAsyncEnumerable`1.Enumerator.&lt;MoveNext&gt;d__3.MoveNext()
  --- End of stack trace from previous location where exception was thrown ---
     at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
     at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
     at Microsoft.EntityFrameworkCore.Query.Internal.AsyncLinqOperatorProvider.ExceptionInterceptor`1.EnumeratorExceptionInterceptor.&lt;MoveNext&gt;d__5.MoveNext()
  --- End of stack trace from previous location where exception was thrown ---
     at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
     at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
     at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
     at ManualTesting.EntryPint.&lt;MainAsync&gt;d__1.MoveNext()
  --- End of stack trace from previous location where exception was thrown ---
     at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
     at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
     at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
     at ManualTesting.EntryPint.Main(String[] args)
  </code></pre>
  
  <p>I have SqlServer 2016 and this is a .Net Core application.</p>
  
  <p>Here is the DbContext</p>
  
  <pre><code>namespace TrackTv
  {
      using Microsoft.EntityFrameworkCore;
  
      using TrackTv.Models;
      using TrackTv.Models.Joint;
  
      public class TrackTvDbContext : DbContext
      {
          public DbSet&lt;Actor&gt; Actors { get; set; }
  
          public DbSet&lt;Episode&gt; Episodes { get; set; }
  
          public DbSet&lt;Genre&gt; Genres { get; set; }
  
          public DbSet&lt;Network&gt; Networks { get; set; }
  
          public DbSet&lt;Show&gt; Shows { get; set; }
  
          public DbSet&lt;User&gt; Users { get; set; }
  
          protected override void OnConfiguring(DbContextOptionsBuilder builder)
          {
              builder.UseSqlServer(@"Server=.;Database=TrackTvDb;Trusted_Connection=True;MultipleActiveResultSets=True;");
  
              base.OnConfiguring(builder);
          }
  
          protected override void OnModelCreating(ModelBuilder modelBuilder)
          {
              // ShowsUsers
              modelBuilder.Entity&lt;ShowsUsers&gt;().HasKey(t =&gt; new
                          {
                              t.UserId,
                              t.ShowId
                          });
              modelBuilder.Entity&lt;ShowsUsers&gt;().HasOne(t =&gt; t.User).WithMany(user =&gt; user.ShowsUsers).HasForeignKey(t =&gt; t.UserId);
              modelBuilder.Entity&lt;ShowsUsers&gt;().HasOne(t =&gt; t.Show).WithMany(show =&gt; show.ShowsUsers).HasForeignKey(t =&gt; t.ShowId);
  
              // ShowsActors
              modelBuilder.Entity&lt;ShowsActors&gt;().HasKey(t =&gt; new
                          {
                              t.ShowId,
                              t.ActorId
                          });
              modelBuilder.Entity&lt;ShowsActors&gt;().HasOne(t =&gt; t.Show).WithMany(show =&gt; show.ShowsActors).HasForeignKey(t =&gt; t.ShowId);
              modelBuilder.Entity&lt;ShowsActors&gt;().HasOne(t =&gt; t.Actor).WithMany(actor =&gt; actor.ShowsActors).HasForeignKey(t =&gt; t.ActorId);
  
              // ShowsGenres
              modelBuilder.Entity&lt;ShowsGenres&gt;().HasKey(t =&gt; new
                          {
                              t.ShowId,
                              t.GenreId
                          });
              modelBuilder.Entity&lt;ShowsGenres&gt;().HasOne(t =&gt; t.Show).WithMany(show =&gt; show.ShowsGenres).HasForeignKey(t =&gt; t.ShowId);
              modelBuilder.Entity&lt;ShowsGenres&gt;().HasOne(t =&gt; t.Genre).WithMany(genre =&gt; genre.ShowsGenres).HasForeignKey(t =&gt; t.GenreId);
          }
      }
  }
  </code></pre>
  
  <p>My project.json</p>
  
  <pre><code>{
    "version": "1.0.0-*",
    "buildOptions": {
      "emitEntryPoint": true
    },
  
    "frameworks": {
      "netcoreapp1.0": {
        "dependencies": {
          "Microsoft.NETCore.App": {
            "type": "platform",
            "version": "1.0.1"
          },
          "TrackTv": "*",
          "Microsoft.EntityFrameworkCore.SqlServer": "1.0.1"
        }
      }
    }
  }
  </code></pre>
  
  <p>I can login with Management Studio like this:
  <a href="https://i.stack.imgur.com/eo33P.png" rel="noreferrer"><img src="https://i.stack.imgur.com/eo33P.png" alt=""></a></p>
  
  <p>I have several other working .NET applications that access that instance of SqlServer with EF6.</p>