简体   繁体   中英

Database mirroring with sql server does not work with my asp.net application using EF

I have database mirroring setup to work with the production database for my asp.net application. When the system fails over to the mirrored database, the application crashes because the connection string is invalid.

If the failover is dependent on a connection string, what kinds of changes do I need to make to my application in order to ensure that it can fail over without my manually changing the connection string?

Do I put exception handling behavior around the EF code where it automatically changes its connection string?

Depending on the type of failover you have set up, I believe there is a connection string property that you can specify the failover DB.

Data Source=myServerAddress;Failover Partner=myMirrorServerAddress;Initial Catalog=myDataBase;Integrated Security=True;

From here: http://www.connectionstrings.com/sql-server-2008

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM