today we tried to connect to an azure database with entity framework. We got an error, which we can't interpret:
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: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
Stack overflow and other helping pages has no working solutions for us. The connection string is correct, the firewall port 1433 is also enabled on both sides (windows and azure).
Does anyone know this problem? thanks
Finally we got the problem. And it's a shame, that it was so simple... We saved our app.config containing the connectionstring in the wrong project. It has to be in the project of the application, we had it in our Entity Framework project. That was the problem.
For the command update-database you can add the connectionstring to the end:
update-database –TargetMigration “201606011014100_InitialCreate” –ConnectionString “Server=tcp:xyzabcdef.database.windows.net,1433;Data Source=xyzabcdef.database.windows.net;Initial Catalog=asdf;Persist Security Info=False;User ID=asdf;Password=asdf;Pooling=False;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=20;” –ConnectionProviderName “System.Data.SqlClient”
maybe it helps someone else :) thanks
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.