I have a couple of "classic" ASP apps that need to connect to a SQL Server database that is using database mirroring. Can ASP handle the failover in a similar way to ASP.NET? As in if I adjust the connection string to put the failover server details?
Asked
Active
Viewed 1,062 times
2 Answers
0
Why not just let MSSQL do the job or you.
In your web.config set your connection string this way :
<connectionStrings>
<add name="myConnection" connectionString="Data Source=myDBServerAddress;
Failover Partner=myDBMirrorServerAddress;Initial Catalog=myDataBase;
Integrated Security=True;"
providerName="System.Data.SqlClient" />
</connectionStrings>

Mike Verrier
- 484
- 2
- 16
-
You might want to try the "FailoverPartner" options without the space, I've seen that mentioned elsewhere. – Thomas Kjørnes Oct 21 '11 at 04:34
-1
Yes, as far as the ASP application is concerned, it is seen as a host. If you have automatic failover setup, SQL server will deal with everything. If you have manual failover, you may need to change the host in the connection string. Everything else will then work as normal.

ChrisBint
- 12,773
- 6
- 40
- 62
-
No, I'm not clustering, I'm mirroring (transaction shipping). In ASP.NET, the web.config has both servers mentioned, not just one. – Piers Karsenbarg Oct 18 '11 at 10:34
-
You can have automatic failover with mirroring. If you have both servers in the web.config, it is likely that their is some 'failover' code implemented directly in c#/vb.net to connect to one or the other hosts based on connectivity. – ChrisBint Oct 18 '11 at 10:38
-
I know you can have automatic failover. I have automatic failover. But in ASP.NET, you put both servers in the web.config and it will handle it. But I want to know if I can do the same in the connection string for an ASP app. – Piers Karsenbarg Oct 18 '11 at 10:49
-
If the asp.net app has multiple connection strings, it is not for any kind of automatic failover that I know of. It will either be for distinct connections for specific information or for a hand-rolled failover. As initially stated, if you have failover on your sql setup, you only need to set this in your ASP connection string and the rest will happen automatically. – ChrisBint Oct 18 '11 at 10:58
-
No, one connection string, but two references to the database like here: http://www.codeproject.com/KB/database/sqlmirroring.aspx (step 5) – Piers Karsenbarg Oct 18 '11 at 11:36