title: SQL Server Express with Hangfire connect problem : login failed for user
body: <p>I'm trying to connect to SQL Server Express in my <code>Hangfire service</code>.</p>
  
  <p>Code in my <code>Startup.cs</code> looks like this:</p>
  
  <pre><code>services.AddHangfire(configuration =&gt; configuration
              .SetDataCompatibilityLevel(CompatibilityLevel.Version_170)
              .UseSimpleAssemblyNameTypeSerializer()
              .UseRecommendedSerializerSettings()
              .UseSqlServerStorage(Configuration.GetConnectionString("HangfireConnection"), new SqlServerStorageOptions
              {
                  CommandBatchMaxTimeout = TimeSpan.FromMinutes(5),
                  SlidingInvisibilityTimeout = TimeSpan.FromMinutes(5),
                  QueuePollInterval = TimeSpan.Zero,
                  UseRecommendedIsolationLevel = true,
                  UsePageLocksOnDequeue = true,
                  DisableGlobalLocks = true
              }));
  
          services.AddHangfireServer();
  </code></pre>
  
  <p>Based on documentation, Hangfire 1.7 have <code>built ib sql query</code> to create database.</p>
  
  <p>I make default connection string from docs:</p>
  
  <pre><code>"HangfireConnection": "Server=.\\sqlexpress; Database=Hangfire; Integrated Security=SSPI;"
  </code></pre>
  
  <p>But when I run my app, I get this error:</p>
  
  <blockquote>
    <p>System.Data.SqlClient.SqlException: 'Cannot open database "Hangfire" requested by the login. The login failed.<br>
    Login failed for user 'DESKTOP-FOVJ16Q\Michal'</p>
  </blockquote>
  
  <p>My <code>Security</code> tab from SQL Server Express looks like this:</p>
  
  <p><a href="https://i.stack.imgur.com/lvbu0.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/lvbu0.png" alt="enter image description here"></a></p>
  
  <p>Could you tell me, what can I check to make connection with my SQL Server Express?</p>
  
  <p><strong>EDIT1</strong></p>
  
  <p>My SQL Server Express "Security" tab with <code>Logins</code>:</p>
  
  <p><a href="https://i.stack.imgur.com/hfAV7.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/hfAV7.png" alt="enter image description here"></a></p>
  
  <p>My <code>DESKTOP-FOVJ16Q\Micha</code> properties:</p>
  
  <p><a href="https://i.stack.imgur.com/m9AEF.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/m9AEF.png" alt="enter image description here"></a></p>
  
  <p><strong>EDIT2</strong></p>
  
  <p>I checked for now, from that connection string:</p>
  
  <pre><code>"Server=.\\SQLEXPRESS;Database=TaskManager;Trusted_Connection=True;"
  </code></pre>
  
  <p>I can simply make database in my <code>SQL Express</code> and look on it in <code>Management studio</code></p>