Reputation: 5153
Am I correct that I cannot access a SQL Server database hosted on Azure from a WebJob?
I am getting:
Unhandled Exception: System.Data.SqlClient.SqlException: 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)
I think I need to use Azure Table Storage instead, can EF code-first be used with Table Storage? Or should this be working?
The web app is working locally and on live, only the web job project fails to connect.
I am using a newly created Basic tier plan SQL Database created in Azure with default settings, I've not added anything to the firewall as the web app had access to it out of the box.
Under Application Settings I have:
Upvotes: 1
Views: 743
Reputation: 48402
If you couldn't access SQL Azure from a Webjob, nobody would be using Webjobs. You most certainly can. I do so with my Webjobs. And you certainly don't want to use Azure Table Storage to try and mimic a relational database. It won't work. My guess is that your webjob has an incorrect connection string, or the location of the webjob (IP Address) doesn't have an opening in the Azure firewall.
Upvotes: 3