Tinku Chacko
Tinku Chacko

Reputation: 520

Connect my local host database to the windows Azure asp mvc 4

I am using Asp.net MVC4 and I want to connect my application which runs on my localhost to connect to windows azure database.

I have edited the connection string in the web.config as shown below, and I have also added a firewall rule in windows rule. Please offer me some suggestions on how I can get this working.

I have tried the following connection strings

<add name="connectionString" connectionString="Data Source=xxxxxxxxxxxxxx;Database=xxxxxxx;User ID=xxxxx@xxxxxx;Password=xxxxxxxx;Trusted_Connection=False;" providerName="System.Data.EntityClient" />

<add name="connectionString" connectionString="metadata=.\xxxxxxxxx.csdl|.\xxxxxxxxx.ssdl|.\xxxxxxxxxxxx.msl; provider=System.Data.SqlClient;provider connection string=&quot;Data Source=xxxxxxxxxxxx;Database=xxxxxxxxxxx;User ID=xxxx@xxxxxxxxxx;Password=xxxxxxxxx;Trusted_Connection=False;&quot;" providerName="System.Data.EntityClient" />

Upvotes: 3

Views: 1331

Answers (2)

Rudy Setyo Purnomo
Rudy Setyo Purnomo

Reputation: 7

If the firewall on Azure side has been allowed, make sure that your local ISP also support SQL Server 1433 port to allow your application to communicate with the database.

Upvotes: 1

Rajeshkumar Kandhasamy
Rajeshkumar Kandhasamy

Reputation: 6461

You can't keep the Data Source to connect the DataBase. Instead of that you can put the given connection string like below.

<connectionStrings>
       <add name="ConnectionStringName" connectionString="Server=YOURSERVERIP;Database=DATABASENAME;User ID=YOURDBID;Password=YOURDBPASSWORD;Trusted_Connection=False;Encrypt=True;Connection Timeout=30;"
      providerName="System.Data.SqlClient" />
  </connectionStrings>

I'm able to use/access the cloud db like above..

Upvotes: 1

Related Questions