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)
In article <71guSDCY...@nospamthankyou.spam>, Alan Silver
<alan-...@nospam.thanx.invalid> writes
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
There are several reasons for this "generic error" for example, if you
are using profile variables to manage application state, using ASP
built in security, or allow users to change the look and feel of the
page. Anyway...
Solution:
open Visual Studio Command Prompt (Start => All Programs => Microsoft
Visual Studio 2005 => Visual Studio Tools => Visual Studio Comman
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 found
in Windows\Microsoft.net\Framwork\vx.0xxxx\config) and find/change the
following line of code
<!--
comment out the following...
<add name="LocalSqlServer" connectionString="data
source=.\SQLEXPRESS;Integrated
Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User
Instance=true" providerName="System.Data.SqlClient" />
-->
<add name="LocalSqlServer" connectionString="Data
Source=YOURSQLSERVER;Initial Catalog=ASPNETDB;User
ID=bhammond;password=bhammond" />
By default, ASP uses SQLExpress. Comment out that line of code and add
the one above (Setting appropriate properties)
--
bradhammond
------------------------------------------------------------------------
bradhammond's Profile: http://www.dbtalk.net/m517
View this thread: http://www.dbtalk.net/t288790