Azure Tip – Check Cross Project Connection Strings

TL;DR; – When using multiple project solutions, make sure you database context and configuration connection strings are named the same across all projects.

I spent a good 4 hours last week (probably more) going slightly mad trying to diagnose an odd Azure issue. I had setup a web app, setup a database, and all of the deployment / synchronization goodies that went with it. However, when I went to launch and work with the application, I was getting the dreaded “network” error indicating that the application couldn’t find the database specified. To make matters even more maddening, I was able to setup a firewall rule and connect to the database from my local machine without a hassle.

I finally tracked the issue down. We had muliple projects in our solution, two of them being a typical MVC app and a data access layer (DAL) app to manage all the data interaction. The DAL app had it’s base context name set to “TechConnection” whereas the MVC application had a value named “DefaultConnection” in the web.config file. While this worked fine locally (not sure why just yet) the mismatch caused problems in the deployed Azure environment. A quick name change in the web.config file restored functionality (and my sanity).

Say… can I get my $30 tech support subscription money back since I solved it first Microsoft? 8^D

What are your 10 bits on the matter? I want to know!

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s