So I was working on a web site that uses the ASP.Net membership provider but was connecting it to an existing database.  I tried for about an hour to get this web site up and going and kept getting an error when trying to create a new user in the membership database using this command

Membership.CreateUser(UserID.Text, Password.Text, EMail.Text);
Message.Text = “User Created.”;
UserID.Text = “”;
Password.Text = “”;
catch(Exception ex)
Message.Text = “Error in creating User” + ex.Message + ” — ” + ex.InnerException;

The Membership.CreateUser function is part of the System.Web.Security name space and as long as you have the web.config set up correctly you don’t have to add any extra code to get a user created.


Here is the error that I was getting;

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) — System.ComponentModel.Win32Exception (0x80004005): The network path was not found

I kept trying different things in my connection string to get it to connect.  I made sure that SQL Server was up and receiving remote connections, and I checked all the protocols in the SQL Configuration tool and made sure they were enabled too.  I changed the connection string to try and get it to connect but none of these worked.






While searching I came across this post

where he states that he can fix it and has several things to do and try.  I was happy that I did not have to try them all as I fixed my problem with one little tool.

The “SQLCMD -L” command being ran at the command prompt returned back a list of the SQL Servers it could find on the local network.  Since I was on an external wireless and not on our network I only got two entries back.  ComputerName\SQLSERVER2012 and ComputerName\SQLEXPRESS.   Arrggg that was it, since this was not my laptop I was not the one to install everything and someone from before installed SQL Server Express.  Then when they went to install SQL Server 2012 they accepted the defaults and installed the server as a SQL Instance.


This totally changes how SQL communicates and how you have to connect to it.  So, once I changed my SQL ConnectionString everything started working great. Now I have my connection string as


So, if you are having this error, run SQLCMD -L and make sure that the SQL Server name is the same in the list as it is in your Connection String.