Connection string for mirrored database on Azure in Azure Websites

395 views Asked by At

I have database mirroring setup on Azure as outlined in this article. My question is how do I connect to the database in ASP.net? I know I can use Data Source="DB1";Failover Partner="DB2" in my connection string but the problem is that my three VM's are using the same cloud service meaning their public IP addresses are all the same as well as their URL's. I originally thought I might be able to access them using their internal IP addresses, but Azure Websites does not seem to allow me to select which Cloud Service it runs under.

Any help much appreciated.

1

There are 1 answers

2
astaykov On

Good question.

With no easy answer for time being (Jan. 2014)! The issue is that, the easiest way is really use Internal IP Addresses. This will only be possible if all the resources are part of the same Virtual Network. But as of today, Azure Web Site cannot be part of Azure VNet. So, the easy answer is - you can't really do that.

The tough one is - you have to manage a middle-ware load-balancer of your own, or use a different configuration for SQL Server Fail Over or High-availability. Either of the solutions are too broad and primarily opinion based to further discuss them.

UPDATE based on the comments

Actually there is a way to have 2 Public IP Addresses for the machines. You can deploy the two VMs to separate cloud services. Still the same Virtual Network. The limit is 1 public address per Cloud Service. And your Azure VM is actually deployed to a cloud service. So put each VM in its own Cloud Service and you are good to go.