title: Setting Up ASP.NET Identity Core in an empty ASP.NET Core Web Application
body: <p>I am trying to start a new web application project and I wanted to use the asp.net identity database (the one with all the AspNet tables (AspNetUsers, AspNetRoles etc)).</p>
  
  <p>I have tried to follow numerous guides, these among other:</p>
  
  <ul>
  <li>bitoftech.net/2015/01/21/asp-net-identity-2-with-asp-net-web-api-2-accounts-management/</li>
  <li>johnatten.com/2014/04/20/asp-net-mvc-and-identity-2-0-understanding-the-basics/</li>
  <li>tektutorialshub.com/asp-net-identity-tutorial-basics/%20%22ASP.Net%20Identity%20Tutoria</li>
  <li>benfoster.io/blog/aspnet-identity-stripped-bare-mvc-part-1</li>
  </ul>
  
  <p>However when I tried to create the database I get this <a href="http://i.stack.imgur.com/bD1VW.png" rel="nofollow">error</a>.</p>
  
  <p>I have also tried to do it by mimicking the template project (ASP.NET Core Web Application(.Net Core)) in Visual Studio with the same result or <a href="http://i.stack.imgur.com/4YEUc.png" rel="nofollow">this one</a> </p>
  
  <p>This is how my project looks like, its basically the template minus the Controllers, Views and Models.</p>
  
  <p>Startup.cs</p>
  
  <pre><code>public class Startup
  {
      public Startup(IHostingEnvironment env)
      {
          var builder = new ConfigurationBuilder()
              .SetBasePath(env.ContentRootPath);
  
          builder.AddEnvironmentVariables();
  
          Configuration = builder.Build();
      }
      public IConfigurationRoot Configuration { get; }
  
      // This method gets called by the runtime. Use this method to add services to the container.
      // For more information on how to configure your application, visit http://go.microsoft.com/fwlink/?LinkID=398940
      public void ConfigureServices(IServiceCollection services)
      {
          //var connectionString = @"Data Source=(localdb)\mssqllocaldb;Initial Catalog=Northwind;Integrated Security=True;Pooling=False";
  
          //services.AddEntityFramework()
          //    .AddSqlServer()
          //    .AddDbContext&lt;NorthwindContext&gt;(o =&gt;
          //    o.UseSqlServer(connString));
  
          services.AddDbContext&lt;ApplicationDbContext&gt;(options =&gt;
          options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection")));
  
          services.AddIdentity&lt;ApplicationUser, IdentityRole&gt;()
              .AddEntityFrameworkStores&lt;ApplicationDbContext&gt;()
              .AddDefaultTokenProviders();
  
          services.AddMvc();
      }
  
      // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
      public void Configure(IApplicationBuilder app)
      {
          app.UseDeveloperExceptionPage();
  
          app.UseStaticFiles();
  
          app.UseIdentity();
  
          app.UseMvc(routes =&gt;
          {
              routes.MapRoute(
                  name: "default",
                  template: "{controller=Home}/{action=Index}/{id?}");
          });
      }
  }
  </code></pre>
  
  <p>ApplicationUser.cs</p>
  
  <pre><code>public class ApplicationUser : IdentityUser
  {
  }
  </code></pre>
  
  <p>ApplicationDbContext.cs</p>
  
  <pre><code>public class ApplicationDbContext : IdentityDbContext&lt;ApplicationUser&gt;
  {
      public ApplicationDbContext(DbContextOptions&lt;ApplicationDbContext&gt; options)
          : base(options)
      {
      }
  
      protected override void OnModelCreating(ModelBuilder builder)
      {
          base.OnModelCreating(builder);
          // Customize the ASP.NET Identity model and override the defaults if needed.
          // For example, you can rename the ASP.NET Identity table names and more.
          // Add your customizations after calling base.OnModelCreating(builder);
      }
  }
  </code></pre>
  
  <p>I just want to have an empty project with asp.net identity, preferably in SQL server instead of in localdb. Does anyone have a easy guide or know why it does not work for me? </p>
  
  <p>EDIT1</p>
  
  <pre><code>public class ApplicationDbContext : IdentityDbContext&lt;ApplicationUser&gt;
  {
  
      public ApplicationDbContext() : this("Data Source=ACLAP;Initial Catalog=tmpCore;Integrated Security=True;Connect Timeout=15;Encrypt=False;TrustServerCertificate=True;ApplicationIntent=ReadWrite;MultiSubnetFailover=False") { }
  }
  </code></pre>
  
  <p>EDIT2
  I have put up the project on github.</p>
  
  <p>github.com/KiBlob/test</p>