Richard van Schie

Richard van Schie

  • NA
  • 7
  • 10.2k

Windows Service login error after database failover

Jan 5 2011 5:14 AM

I've created a windows service that connects to a database. My connection string supports the Failover Partner.
SqlConnection
conn = new SqlConnection("Persist Security Info=False;User ID=user;Password=xxx;Data Source=Server_A;Initial Catalog=DatabaseName;Failover Partner=Server_B");
When the database is running on the main-server, all is working well. When I do a failover, the service errors with: Cannot open database "DatabaseName" requested by the login. The login failed.
I know that both SIDS of the user are the same. When using a webapplication on the same database with the same user everything works fine. Using domain accounts results in the same error. When failing back to the main-server everything is working fine again.
Does anyone have any solution?