gdpm
gdpm

Reputation: 39

Can't connect to Azure SQL server, error:

i got the error below when im trying to access my site hosted on Azure. Im using Database connectionString copied straight from the Database management panel on Azure but coudlnt connect successfully

A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)]

any ideas how to actually solve it? thanks

Upvotes: 1

Views: 1444

Answers (3)

user1232299
user1232299

Reputation:

thanks for answer, but the solution was that i didn't notice the SQL database i was using was MySQL, and i was using

      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />

instead of

    <provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6, Version=6.9.7.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />

unfortunately errors didnt say anything about providers being not compatible ;>

btw, sorry, didnt notice i made a post with different account

Upvotes: 0

JuanK
JuanK

Reputation: 2094

You need to add your azure services or external IP address in a rule into to DB server firewall.

Follow these steps:

  1. Goto Db dashboard
  2. On DB properties click on server name

DB server properties

  1. Then in the new panel goto "All settings"

db server settings

  1. Then goto firewall

db server firewall

  1. enable access from azure services
  2. if need it, add the ip address of you web app.

db server firewall rules

Upvotes: 1

user1232299
user1232299

Reputation:

the SQL is hosted on Azure, no i have not heard about setting up the IP based access rule, ill check this out

Upvotes: 0

Related Questions