I can connect from Management Studio using my domain credentials.
From within the VS IDE I can connect to the database ok however when I try debugging my WebApp it comes up with
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)
The connection string from the web.config is
<connectionStrings>
<
add
name="TESTSQLConnectionString"
connectionString="Data
Source=(local);Initial Catalog=SAMPLEDB;Integrated Security=SSPI;Min Pool Size=5;Max Pool Size=60;Connect Timeout=30"
providerName="System.Data.SqlClient"/>
</
connectionStrings>
Things I have tried.
Changing ports 1433
Firewall disabling
Remote Connection enabled on SQL Server
TCP/IP and Named Pipes enabled in configuration
Modified Web.Config to use IP Addresses/ Usernames passwords /Trusted_Connections/ Different SQL Server on a different machine
Well it turns out that I have extended the membership provider but forgot to extend the role provider. So even though the membership provider was quite happy looking at my connectionstring the default Role Provider was searching for an SQLExpress install.
Thank you for your post...you saved me lots of time...
I had similar problem but when trying to connect with Management Studio got the same error. The issue is that I had this working just a few days (weeks?) ago, so something (a patch, configuration, etc) changed.
So the problem arose from somehow not recognizing that KC118052 was the localmachine...weird...I think I'm heading towards having to rebuild the entire machine...argh!
Thank you again.
Update: Found the reason(?) for the issue: the hosts file had the wrong public IP for my machine's name. Once corrected the issue went away. I can now connect both to .\sqldev and kc118052\sqldev
I'm getting this same error and it's driving me nuts. In my project, initially I was using SQLExpress, but later changed to using an MS-Access database for simplicity's sake. It works just perfectly on my development machine. However, after uploading
the files to the web server, it still seems to think I want to connect to a SQL Server database for some unknown reason. I've copied and recopied all of the required files to the web server, but no luck. What on Earth could I be missing?
No, I'm not using Linq. But, I'm not sure what you mean when you ask about the Access database being installed remotely from the web server. I simply dropped the MDB file in the App_Data folder directly under the website's root folder just like it is
in my project locally. I'm using the AccessDataSource control manage the data connection.
Well, I sucked it up and just completely rebuilt my solution from scratch and then replaced the web forms and code files from what I had already developed and now it finally works on the server. Obviously there was some leftover crap somewhere (in the web.config
probably) that was somehow referencing the SQLExpress database I started with.
I'm going to try and compare the old web.config with the new, but I have a feeling this is going to remain an unexplained mystery.
I had similar issue, when I unistalled the SQL which had a Named Instance and Installed SQL with Default Instance.
The Error I got is:
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)
To resolve the issue - I had to change the VSTS Options; From Tools -> Options -> Data base Tools -> Design Time - Validation Data base -> Connection Options -> SQL Serevr Instance Name = Blank.
connectionStrings add name="ConnectionString" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Update.mdf;Integrated Security=True;User Instance=True" providerName="System.Data.SqlClient" connectionStrings the closing and opening
braces are there. i have personally removed here. i'm also getting the same error. above is my code. please check it whether it's correct or not. on my system it's working fine. but when i upload my website to the webserver (internet) it gave this error. can
u tell me it's a problem with my coding or the webserver side problem. thanks.
gumby2701
Member
4 Points
31 Posts
A network-related or instance-specific error occurred while establishing a connection to SQL Serv...
Oct 16, 2008 04:04 AM|LINK
Hi,
I am completely stumped.
Im running
I can connect from Management Studio using my domain credentials.
From within the VS IDE I can connect to the database ok however when I try debugging my WebApp it comes up with
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)
The connection string from the web.config is
<connectionStrings><
add name="TESTSQLConnectionString" connectionString="Data Source=(local);Initial Catalog=SAMPLEDB;Integrated Security=SSPI;Min Pool Size=5;Max Pool Size=60;Connect Timeout=30" providerName="System.Data.SqlClient"/></
connectionStrings>Things I have tried.
So I have absolutely no idea what to do anymore.
Can anyone give me suggestions on what to try?
Many Thanks
Jeremy
gumby2701
Member
4 Points
31 Posts
Re: A network-related or instance-specific error occurred while establishing a connection to SQL ...
Oct 16, 2008 07:09 AM|LINK
Well it turns out that I have extended the membership provider but forgot to extend the role provider. So even though the membership provider was quite happy looking at my connectionstring the default Role Provider was searching for an SQLExpress install.
Oh well hope someone learns from my mistakes :)
Cheers
Dei401
Member
4 Points
2 Posts
Re: A network-related or instance-specific error occurred while establishing a connection to SQL ...
Oct 16, 2008 06:35 PM|LINK
Thank you for your post...you saved me lots of time...
I had similar problem but when trying to connect with Management Studio got the same error. The issue is that I had this working just a few days (weeks?) ago, so something (a patch, configuration, etc) changed.
Anyway, before I would try to connect with "machineName\InstanceName" (KC118052\SQLDEV)...after reading your post and having done the rechecking from http://www.mydigitallife.info/2007/10/31/error-has-occurred-while-establishing-a-connection-to-sql-server-2005-which-does-not-allow-local-and-remote-connections/ I remembered some issues I was having with IIS 7.0 and changes I made. I tried then connecting with ".\InstanceName" (.\SQLDEV) and it worked!
So the problem arose from somehow not recognizing that KC118052 was the localmachine...weird...I think I'm heading towards having to rebuild the entire machine...argh!
Thank you again.
Update: Found the reason(?) for the issue: the hosts file had the wrong public IP for my machine's name. Once corrected the issue went away. I can now connect both to .\sqldev and kc118052\sqldev
rhmayer
Member
650 Points
186 Posts
Re: A network-related or instance-specific error occurred while establishing a connection to SQL ...
Oct 29, 2008 03:25 AM|LINK
I'm getting this same error and it's driving me nuts. In my project, initially I was using SQLExpress, but later changed to using an MS-Access database for simplicity's sake. It works just perfectly on my development machine. However, after uploading the files to the web server, it still seems to think I want to connect to a SQL Server database for some unknown reason. I've copied and recopied all of the required files to the web server, but no luck. What on Earth could I be missing?
- Robert -
Dei401
Member
4 Points
2 Posts
Re: A network-related or instance-specific error occurred while establishing a connection to SQL ...
Oct 29, 2008 12:59 PM|LINK
Are you by any chance using linq in your solution?
Is your access database installed remotely from the web server?
rhmayer
Member
650 Points
186 Posts
Re: A network-related or instance-specific error occurred while establishing a connection to SQL ...
Oct 30, 2008 03:06 AM|LINK
No, I'm not using Linq. But, I'm not sure what you mean when you ask about the Access database being installed remotely from the web server. I simply dropped the MDB file in the App_Data folder directly under the website's root folder just like it is in my project locally. I'm using the AccessDataSource control manage the data connection.
- Robert -
rhmayer
Member
650 Points
186 Posts
Re: A network-related or instance-specific error occurred while establishing a connection to SQL ...
Oct 30, 2008 04:56 AM|LINK
Well, I sucked it up and just completely rebuilt my solution from scratch and then replaced the web forms and code files from what I had already developed and now it finally works on the server. Obviously there was some leftover crap somewhere (in the web.config probably) that was somehow referencing the SQLExpress database I started with.
I'm going to try and compare the old web.config with the new, but I have a feeling this is going to remain an unexplained mystery.
sivaram_ram
Member
2 Points
1 Post
Re: A network-related or instance-specific error occurred while establishing a connection to SQL ...
Feb 13, 2009 10:03 AM|LINK
I had similar issue, when I unistalled the SQL which had a Named Instance and Installed SQL with Default Instance.
The Error I got is:
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)
To resolve the issue - I had to change the VSTS Options; From Tools -> Options -> Data base Tools -> Design Time - Validation Data base -> Connection Options -> SQL Serevr Instance Name = Blank.
Hope this info will be helpful for some people.
VSTS 2008 Data base Projects
jon80
Member
15 Points
26 Posts
Re: A network-related or instance-specific error occurred while establishing a connection to SQL ...
Mar 14, 2009 10:36 AM|LINK
I have a similar error, however, can you specify how you went about solving this issue when it occurred?
varun jain
Member
14 Points
9 Posts
Re: A network-related or instance-specific error occurred while establishing a connection to SQL ...
Mar 25, 2009 04:42 AM|LINK