How to call AdomdConnection from hangfire background job using windows identify

13 Views Asked by At

I have developed a hangfire background job which connects to SSAS to read data. This job works fine locally (behind firewall) but not on server. SSAS requires windows authentication. How to setup windows Identify on background job so that job always runs with a defined account.

 RecurringJob.AddOrUpdate<JobClassHere>("XXX" job => job.Execute(null, "JobNameHere"), "JobScheduleHere");
 
 
 using (var cn = new AdomdConnection(connectionstringhere))
                {
                  var cmd = cn.CreateCommand();
                    cmd.CommandText = "XXX";
                    using (var reader = cmd.ExecuteReader())
                    {
                      "Reader code here"
                    }
                }

0

There are 0 best solutions below