Discussion:
SQL Server 2005 - SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified on local machine
(too old to reply)
Alan Silver
2006-03-01 18:45:44 UTC
Permalink
Hello,

I have SQL Server 2005 standard edition installed on my local machine,
along with IIS6 and .NET 2.0.

I downloaded the ASP.NET design templates from MS (see below for URL),
and one of them uses a database. This one gives me the following error
when it tries to access the database...

"An error has occurred while establishing a connection to the server.
When connecting to SQL Server 2005, this failure may be caused by the
fact that under the default settings SQL Server does not allow remote
connections. (provider: SQL Network Interfaces, error: 26 - Error
Locating Server/Instance Specified)"

Now, I have done some searching on this error, and it generally seems to
arise when you are trying to connect to SQL Server from another (ie
remote) machine. I'm not, I have SQL Server and IIS on the same machine.

I have followed all the advice mentioned on
http://www.datamasker.com/SSE2005_NetworkCfg.htm (even though that's for
remote access and this is local), and have rebooted the machine. None of
this helped.

The connection string in the web.config file looks like this...

Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\pubs.mdf;
Integrated Security=True;User Instance=True

I strongly suspect that the problem could be the SQLEXPRESS data source
there, but I have tried changing that to MSSQLSERVER, 127.0.0.1, (local)
and various other things without success. I tried changing the "Data
Source" to "Server" and using the same names, but that also failed.

Looking in the Server Management Studio, I right-clicked the server and
chose properties, then clicked the link "view connection properties"
which showed an empty instance name. I don't know if this is the
problem. As far as I know, there's only the one instance installed.

Any ideas how to sort this? TIA
--
Alan Silver
(anything added below this line is nothing to do with me)
Alan Silver
2006-03-06 15:12:50 UTC
Permalink
Anyone any ideas? I still can't connect to the local server!!
Post by Alan Silver
Hello,
I have SQL Server 2005 standard edition installed on my local machine,
along with IIS6 and .NET 2.0.
I downloaded the ASP.NET design templates from MS (see below for URL),
and one of them uses a database. This one gives me the following error
when it tries to access the database...
"An error has occurred while establishing a connection to the server.
When connecting to SQL Server 2005, this failure may be caused by the
fact that under the default settings SQL Server does not allow remote
connections. (provider: SQL Network Interfaces, error: 26 - Error
Locating Server/Instance Specified)"
Now, I have done some searching on this error, and it generally seems
to arise when you are trying to connect to SQL Server from another (ie
remote) machine. I'm not, I have SQL Server and IIS on the same machine.
I have followed all the advice mentioned on
http://www.datamasker.com/SSE2005_NetworkCfg.htm (even though that's
for remote access and this is local), and have rebooted the machine.
None of this helped.
The connection string in the web.config file looks like this...
Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\pubs.mdf;
Integrated Security=True;User Instance=True
I strongly suspect that the problem could be the SQLEXPRESS data source
there, but I have tried changing that to MSSQLSERVER, 127.0.0.1,
(local) and various other things without success. I tried changing the
"Data Source" to "Server" and using the same names, but that also failed.
Looking in the Server Management Studio, I right-clicked the server and
chose properties, then clicked the link "view connection properties"
which showed an empty instance name. I don't know if this is the
problem. As far as I know, there's only the one instance installed.
Any ideas how to sort this? TIA
--
Alan Silver
(anything added below this line is nothing to do with me)
hfk0
2006-04-03 14:30:09 UTC
Permalink
Hi Alan,

I'm also getting the same error message and have been posting a few
groups here but haven't had any luck so far.

In my case, everything works ok in the development server (running
winxp with IIS, Visual Studio 2005 and SQL server express). It's in the
production server (win2000 server, IIS and SQL server express) that
it's giving me a headache. I also use the same connection string as you
do, and the database connection is ok when I test it within Management
Studio Express.

I'm just wondering if you're able to solve this issue.

hfk0
bradhammond
2006-07-11 20:39:28 UTC
Permalink
Problem:
(provider: SQL Network Interfaces, Error: 26 - Error locatin
server/instance specified)

There are several reasons for this "generic error" for example, if yo
are using profile variables to manage application state, using AS
built in security, or allow users to change the look and feel of th
page. Anyway...

Solution:
open Visual Studio Command Prompt (Start => All Programs => Microsof
Visual Studio 2005 => Visual Studio Tools => Visual Studio Comma
Prompt)

run aspnet_regsql.exe

click next

select Configure SQL Server for applications

click next

Add the server name and LEAVE the database as <default>

click next

click next

the above will create a new database called ASPNETDB

NOW DO THE FOLLOWING


On your web server, search for the file machine.config (generally foun
in Windows\Microsoft.net\Framwork\vx.0xxxx\config) and find/change th
following line of code

<!--
comment out the following...
<add name="LocalSqlServer" connectionString="dat
source=.\SQLEXPRESS;Integrate
Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;Use
Instance=true" providerName="System.Data.SqlClient" />

-->

<add name="LocalSqlServer" connectionString="Dat
Source=YOURSQLSERVER;Initial Catalog=ASPNETDB;Use
ID=bhammond;password=bhammond" />

By default, ASP uses SQLExpress. Comment out that line of code and ad
the one above (Setting appropriate properties

--
bradhammon
-----------------------------------------------------------------------
bradhammond's Profile: http://www.dbtalk.net/m51
View this thread: http://www.dbtalk.net/t28879

Loading...