1
votes

I try to connect to remote SQL Server 2008 Express database from my ASP.NET web application but error throws:

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: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)

How to resolve that problem. Thanks!

2
We might need a little more info here. In particular, if you're trying to connect to SQL Express on another server, don't, because you can't. Express doesn't support it. But, if you're on the same server... can we get more information?Andrew
@Andrew that's a n incorrect statement. You can indeed connect to a SQL Server Express instance remotely. See my answer for specifics.user596075
@Shark My bad... for some reason, I thought otherwise. Thanks for the correction.Andrew

2 Answers

2
votes

Here's the first thing to check. By default Express only has the shared memory protocol enabled. You'll need to enable TCP/IP protocol for the service (SQLEXPRESS). You do this through the SQL Server Configuration Manager.

Also since Express is a named instance, you'll need to ensure that the SQL Server Browser service is started.

Make sure your connection string is correct. When you are hitting a named instance (SQLEXPRESS in this case) you need to have the data source as yourServer\sqlexpress.

And not to mention, make sure you can ping the box that houses the instance.

Check those things out and let me know if that still doesn't fix it.

1
votes

i thing your connection string is not correct. Also check a named instance you try to data source as IPaddress\sqlexpress. Like 000.000.000.000\SqlExpress