Today, I put together a simple reporting application that grabs data from the company’s central database. When I built the application, I got the Named Pipes Provider Error 40. It is a very long winded error that basically says it can’t connect to the local database. Turns out that the work “local” was key.
Since, I was trying to connect to a remote database, I assumed it was a connection problem between my desktop and that server. I fired up SQL Server Management Studio to test the connection and it worked. So, I scratched my head and went Googling. Most of the results had to do with firewalls and TCP/IP protocols. More head scratching. After a little more Googling, I found a post on MSDN pointing out that LightSwitch needs to connect to the local instance of SQL Express even if you are using remote data (this is the MSDN thread: http://social.msdn.microsoft.com/Forums/en-US/lightswitch/thread/ffd8830e-7147-4025-9229-8c9796466902).
A quick check of local SQL Express revealed that the service had been stopped. I started the service and the problem went away.
Here is the easy tip: Read the error message. If it says “local,” it probably means local 😉