Login failed for User when using Database connection in Owin Startup class

459 views Asked by At

I am using Hangfire in my sharepoint provider hosted app. I have Owin Startup class.

public class Startup
{
    public void Configuration(IAppBuilder app)
    {
        GlobalConfiguration.Configuration.UseSqlServerStorage("DefaultConnection");
        RecurringJob.AddOrUpdate(() => Console.WriteLine("Recurring!"), Cron.Minutely);
        app.UseHangfireDashboard();
        app.UseHangfireServer();            
    }
}

I have initialised defaultConnection in my web.config file. Everytime i run, i get error saying Login failed for Domain\MachineName, I tried passing user id and password in connection string, but still is fails saying login failed for that user.

Can anyone help me to find the issue?

1

There are 1 answers

0
Surendra Mourya On BEST ANSWER

I resolved this issue by creating a sql authentication login credential in my SQL server. I passed the created user id and password in my connection string.

<add name="DefaultConnection" connectionString="Data Source=DEESS01CW0184CO\SPQ11CONTENT;Initial Catalog=HangfireTest;User ID='testuser';password='testuser123'" providerName="System.Data.SqlClient" />

enter image description here

The issue still persisted for windows authentication.