Problem:
.NET application throws the following error.
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: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)

Solution:
Check SQL Server to ensure that TCP/IP is enabled. Open the List of available “Protocols for SQL Server”. You can find this in the “Computer Management” Console under “Services and Application”, “SQL Server Configuration Manager”, “SQL Server 200X Network Configuration.” After you enable TCP/IP you will need to restart the SQL Server relational engine. You can do that using the “SQL Server 200X Services” option.
