Azure DB access issue

I'm doing some tests to learn Azure SQL functionality.
I made a very simple application in VS2013.  
Started with a generated website, that has the ASP.NET welcome page.

Added an MDF:
DB table "Names" has three columns.
ID = identity, bigint
Name = nchar(10)
Description = nvarchar(50)

I built a "Names.aspx" page that has a gridview and detail view into the Names table, linked in a master/detail relationship.

To simplify things I change the name of that form to "Default.aspx" when I want to run it instead of the generated Default.aspx.

This all works fine on my PC in debug mode.  I can add table rows, edit, delete, etc.

And it publishes fine to my little test site.   If I use the generated Default page I can see it fine.

However, if I change Default to the "Names" page, I get the error below.

The Azure site-generated connection string in my Azure website Configuration tab looks this, with the correct DB name, user and password.

Data,1433;Initial Catalog=MySite_db;User Id=me@MySite;Password=ComplexPassword;

Open in new window

Any suggestions on how to diagnose this would be appreciated.


Invalid object name 'dbo.Names'.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.Data.SqlClient.SqlException: Invalid object name 'dbo.Names'.

[SqlException (0x80131904): Invalid object name 'dbo.Names'.]
   System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) +1787814
   System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) +5341674
   System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) +546
   System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) +1693
   System.Data.SqlClient.SqlDataReader.TryConsumeMetaData() +61
   System.Data.SqlClient.SqlDataReader.get_MetaData() +90
   System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +377
   System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, SqlDataReader ds) +1421
   System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean asyncWrite) +177
   System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) +53
   System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method) +137
   System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior) +41
   System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior) +10
   System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +140
   System.Data.Common.DbDataAdapter.Fill(DataTable[] dataTables, Int32 startRecord, Int32 maxRecords, IDbCommand command, CommandBehavior behavior) +160
   System.Data.Common.DbDataAdapter.Fill(DataTable dataTable) +108
   DataSetTableAdapters.NamesTableAdapter.GetData() +80

[TargetInvocationException: Exception has been thrown by the target of an invocation.]
   System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) +0
   System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) +192
   System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +155
   System.Web.UI.WebControls.ObjectDataSourceView.InvokeMethod(ObjectDataSourceMethod method, Boolean disposeInstance, Object& instance) +486
   System.Web.UI.WebControls.ObjectDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) +1609
   System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +21
   System.Web.UI.WebControls.DataBoundControl.PerformSelect() +138
   System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +30
   System.Web.UI.WebControls.GridView.DataBind() +4
   System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +105
   System.Web.UI.WebControls.CompositeDataBoundControl.CreateChildControls() +75
   System.Web.UI.Control.EnsureChildControls() +83
   System.Web.UI.Control.PreRenderRecursiveInternal() +42
   System.Web.UI.Control.PreRenderRecursiveInternal() +155
   System.Web.UI.Control.PreRenderRecursiveInternal() +155
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +974

Open in new window

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Éric MoreauSenior .Net ConsultantCommented:
Have you allowed the IP address of your web site? Have a look at

Also, my connection string is a bit different:
Return ",1433;Database=Test;User ID=loginname@ltgftgkor2;Password=password1!;Trusted_Connection=False;Encrypt=True;Connection Timeout=30;"

Open in new window

codequestAuthor Commented:
Thanks for the input.   So, big learning curve here; I mistakenly thought that Azure would link to the files in my App_Data folder.  Clearly not so.

So I
>  used management studio to deploy the database to Azure,
>  made sure my connection with Azure SQL Server allowed access to Azure Services.
>  linked the DB to my web-site as a Linked Resource
>  checked that the connection string was in the website Configure tab, and had the correct password and db name.

The connection string looks like this:

Data,1433;Initial Catalog=mytestsitedb2;User ID=mytestsitedb2admin@mydb1;Password="AComplexPassword"

So at least now there's a chance that it will work, however, I still get the same error.

Do I need to update the configuration string in my web.config file locally?
Any other suggestions?
Éric MoreauSenior .Net ConsultantCommented:
>>I mistakenly thought that Azure would link to the files in my App_Data folder

This doesn't work with Azure.

>>however, I still get the same error.

What about adding the IP address of your host to the list of allowed IP addresses. This is also a requirement.
10 Tips to Protect Your Business from Ransomware

Did you know that ransomware is the most widespread, destructive malware in the world today? It accounts for 39% of all security breaches, with ransomware gangsters projected to make $11.5B in profits from online extortion by 2019.

codequestAuthor Commented:
Thanks for the response.  Where would I find the controls to add IP address of host to list of allowed IP addresses?
Update:  I'm looking here:
Éric MoreauSenior .Net ConsultantCommented:
can't you ping your site?
codequestAuthor Commented:
I can ping the site, however, I'm not sure what to do with the IP address once I  have it.  I'm looking at that link above, maybe that will tell me.
Éric MoreauSenior .Net ConsultantCommented:
it is all described in my article. Check figure 8 and its surrounding.
codequestAuthor Commented:
Actually, I thought I could ping the site, however, I can't.  My site URL is:
When I ping that, ping says "could not find host"

On the other hand, I did figure out where to enter the firewall rule in the DB, as as query of the form:

EXEC sp_set_database_firewall_rule @name = N'mydemosite_FW_Rule_01', @start_ip_address = '', @end_ip_address = ''

And I did find a list of Azure data center IP address ranges, however, there are many, and that seems to be very unspecific.
codequestAuthor Commented:
This is all I see at Azure DB's > Select DB > Configure tab

Snap of Azure DB Config page
Éric MoreauSenior .Net ConsultantCommented:
codequestAuthor Commented:
Also, I can access the Azure SQL DB from my local Management Studio using the proper connections, so I know it's there.
Éric MoreauSenior .Net ConsultantCommented:
Sure because your IP address is trusted.
codequestAuthor Commented:
The main stuck point now seems to be that I can't find the control for
"Add to Allowed IP Addresses"
I can see it in your article, and I can see it in this article
However, I only see the image above in my Azure Dashboard for Databases.
codequestAuthor Commented:
Ah, now I found it, it's under the server, not the individual DBs.  You have to click on the server cell in one of the DB rows to get to the server.

Now the issue is that I can't find an IP address for my site.   Getting closer, though...
codequestAuthor Commented:
Looks like some kind of double bind here.  The "Free" level of websites does not seem to have any fixed IP address.  But an IP address is required to allow DB to be accessed by the site.  I'm SURE this must work somehow;  it would be a giant hole if it did not.  However, it is not clear at all how to get the IP address for the website to put into the firewall rule.
Éric MoreauSenior .Net ConsultantCommented:
Did you look at my second link? David seems to be explaining exactly that.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.