I'm trying to get ASP.net StoreFront to Connect to SQL Server Express 2005, on Windows Server 2008. I followed This Microsoft Support article without success. Below is the error.
[SqlException (0x80131904): 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)]
AspDotNetStorefront.Global.Application_BeginRequest(Object sender, EventArgs e) +286
System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +80
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +171
On a Linux System if I were experiencing this error I would use the SQL specific connection client to test the connection (e.g. mysql
). Possibly use telnet
to test the port, follow up with iptables
if that was the problem. I'm not sure how to go about doing the same things on windows. I've authenticated using SQL Server Management Studio Express using the same credentials? I put a question mark because I'm a bit unsure about one part of the datasource (that should be host/server identifier). I don't think telnet would test the port because windows firewall operates on L7 (it checks the application). How can I find out if the problem is my ability to connect to the server? or the configuration that defines how to connect to the server? (note: security is irrelevant to me, this VM is for development purposes only and is behind my laptops firewalls and has no NAT)
The problem was with my configuration. I ended up troubleshooting it using
sqlcmd.exe
which allowed me to attempt to connect manually using the parameters I had specified, and they didn't work. A look at its documentation and I realized thatlocalhost
was probably insufficient. I needed to include theinstance
, as mentioned in the documenation-S [protocol:]server[\instance_name][,port]
. Adding this to thesqlcmd
string and to the xml configuration fixed my connection issue.