Hi, I am using linq and my users intermittently see this issue. I am not sure what causes it. I am using Linq in my application. Do you have any resolution for this.
I am having the same problem you had, but I don't know how to prevent the Role Provider searching for the SQLExpress install. Where did you correct this ? I erased the SQL express connection in the web.config, but I am still getting the same error !
This issue had me stumped for hours earlier, I have deleted my connection strings in favour of switching from a live to a dev database and everything got screwed. Until I found your post about removing the machine name from my connection string and adding
.\ Everything jumped back to life!
I think this thread has so many hits because people wanting to learn ASP.NET download VSExpress, and then have database connection issues. I downloaded VSExpress and SQL Server, and successfully completed the beginner Wrox book for VS 3.5. Then for some
reason, VS Exoress stopped working. So I tried uninstalling it, and it refused to reinstall. So I tried downloading it again, and it refused to download. So I deleted anything resembling VSExpress from my machine, and I bought the complete VS2008 standard
edition, which installed a version of SQL Server Compact 3.5, which in the Start > All Programs appears as SQL Server 2008. And I went through the beginning book again this time with VS2008. And when I got to Chapter 11 on databases, it allowed me to place
the DB that shipped with the book in the App_Data folder, but when I tried opening it, I got the error message which this thread concerns. I get a complaint about SQL Server 2005, though what's installed appears to be SQL Server 2008. I can imagine many people
are completely green, don't know what Instance Names or IIS are really all about, and just want to write a little Web site with a database.
So here's what I tried:
The Wrox book recommended that if I had trouble establishing a connection to the DB, I read Chapter 18, which suggested I run the site under IIS, so I followed the instructions there. It didn't fix the problem.
The Wrox book recommended I read Appendix B -- configuring SQL Server. It talks first about named and unnamed instances and Windows vs SQL Server authentication, and gives examples of connection strings. My web.config file has simply <connectionStrings/>
with no content.
So I look here and check the machine.config file in the Windows\Microsoft.NET folder and its connection string looks nothing like either. So I try setting the connect string in web-config to look like the one in machine.config, and that doesn't work. So
I try deleting the one in machine.config so it looks like web.config and that doesn't work.
So I read somewhere another magical solution and go to the Options in VS and see the SQL Server Instance name is still set to SQLExpress, so I blank it out as recommended here and try both the above connection string options and that doesn't work.
So I see a recommendation to download SQL Server Management Studio, which I have and which I have installed, and so I'm went through the Wrox instructions for that. And that didn't work
So now I'm reading about 16,000 other threads trying to resolve this. Maybe I'll just toss this stupid Dell in the dumpster.
I must say, I really feel this is too much to ask of someone who just wants to learn to post a Web site with a little database like they have in the Wrox beginner book. It shouldn't be this hard. Maybe you have some IT guru at your workplace that you can
ask to solve all your problems. (It infuriates me that the book keeps recommending that I contact my Network administrator... that would be me. I bought this laptop from Dell, and they didn't ship a network administrator with it.) So what the h??? I bought
this thing for this purpose and I've spent a lot of money and tried really hard...
:-) :-) :-)
SO I'm prepared to buy your book, but at this point, I want a guarantee that after I've invested 120 hours reading and absorbing it, it WILL solve my problem, otherwise you'll fly out here personally and fix my Dell. What do you say?
mukhtar_sadi...
Member
2 Points
1 Post
Re: A network-related or instance-specific error occurred while establishing a connection to SQL ...
Jun 04, 2009 06:25 PM|LINK
Hi, I am using linq and my users intermittently see this issue. I am not sure what causes it. I am using Linq in my application. Do you have any resolution for this.
Thanks,
Nelson Dot N...
Member
66 Points
15 Posts
Re: A network-related or instance-specific error occurred while establishing a connection to SQL ...
Jun 07, 2009 01:40 AM|LINK
Maybe this is the issue.
By default, machine.config uses the connection string LocalSQLServer for "AspNetSqlMembershipProvider"
It's likely that your "AspNetSqlMembershipProvider" in the web.config does not use a connection string named "LocalSQLServer"
You can try to insert <remove name="AspNetSqlMembershipProvider" /> right on top of <add name="AspNetSqlMembershipProvider" .....
Hope that helps.
Taju
Member
14 Points
8 Posts
Re: A network-related or instance-specific error occurred while establishing a connection to SQL ...
Jul 22, 2009 05:40 AM|LINK
Hi
i was facing the error when opening connection using sqlconnection
nw got solved
http://sqlservererror-info.blogspot.com/2009/07/error-has-occurred-while-establishing.html
http://aspnetmembershipprovider.blogspot.com/2009/02/error-has-occurred-while-establishing.html
See This
drtrejos
Member
40 Points
84 Posts
Re: A network-related or instance-specific error occurred while establishing a connection to SQL ...
Jul 27, 2009 08:20 PM|LINK
I am having the same problem you had, but I don't know how to prevent the Role Provider searching for the SQLExpress install. Where did you correct this ? I erased the SQL express connection in the web.config, but I am still getting the same error !
Thanks in advance.
Humberto
drtrejos
Member
40 Points
84 Posts
Re: A network-related or instance-specific error occurred while establishing a connection to SQL ...
Jul 28, 2009 08:48 PM|LINK
I found a way to solve this problems.
It is here: http://forums.asp.net/p/1450454/3317446.aspx#3317446
Humberto
dooie
Member
50 Points
56 Posts
Re: A network-related or instance-specific error occurred while establishing a connection to SQL ...
Aug 13, 2009 05:28 PM|LINK
You little tinker!
This issue had me stumped for hours earlier, I have deleted my connection strings in favour of switching from a live to a dev database and everything got screwed. Until I found your post about removing the machine name from my connection string and adding .\ Everything jumped back to life!
Thank you so much.
mihai.maier
Member
2 Points
1 Post
Re: A network-related or instance-specific error occurred while establishing a connection to SQL ...
Aug 17, 2009 03:16 PM|LINK
Hi,
I have the same problem - i.e. I got the same error, not on a web scenario, but when trying to create a DB project with VS 2008.
Do any of you have an ideea why I'm getting this error, as long as I'm able to connect to SQL server 2005 using the Server Explorer in VS?
I'm not sure this thread is the right place to put this question, but the problem looks quite similar.
Thanks,
Mihai
reginold15
Member
2 Points
2 Posts
Re: A network-related or instance-specific error occurred while establishing a connection to SQL ...
Aug 21, 2009 12:23 AM|LINK
GO TO THE C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CONFIG DIRECTORY WHERE YOU CAN REPLACE THE VERSION OF THE FRAME WORK THAT YOU ARE USING.
IN THIS DIRECTORY U WILL FIND A MACHINE .CONFIG FILE
THIS IS THE SECOND AND THE MOST IMPORTANT CONFIG FILE OF YOU APPLICATION AND CONTAINS A CONNECTION STRING
CHANGE THE CONNECTION STRIN SO AS IT MATCHES THE ONE IN UR WEB CONFIG FILE
IT WORKS ABSOLUTEL FINE..,,.....
SAgacitySolu...
Member
2 Points
4 Posts
Re: A network-related or instance-specific error occurred while establishing a connection to SQL ...
Aug 25, 2009 06:07 PM|LINK
<roleManager enabled="true" defaultProvider="SqlProvider" > <providers> <clear/> <add name="SqlProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="TimetrackerConnectionString" applicationName="/" /> </providers> </roleManager>And BAM! Fixed it...
Thanks so much for your post
hvete
Member
20 Points
10 Posts
Re: A network-related or instance-specific error occurred while establishing a connection to SQL ...
Dec 16, 2009 11:05 PM|LINK
Why 300,000 hits.
I think this thread has so many hits because people wanting to learn ASP.NET download VSExpress, and then have database connection issues. I downloaded VSExpress and SQL Server, and successfully completed the beginner Wrox book for VS 3.5. Then for some reason, VS Exoress stopped working. So I tried uninstalling it, and it refused to reinstall. So I tried downloading it again, and it refused to download. So I deleted anything resembling VSExpress from my machine, and I bought the complete VS2008 standard edition, which installed a version of SQL Server Compact 3.5, which in the Start > All Programs appears as SQL Server 2008. And I went through the beginning book again this time with VS2008. And when I got to Chapter 11 on databases, it allowed me to place the DB that shipped with the book in the App_Data folder, but when I tried opening it, I got the error message which this thread concerns. I get a complaint about SQL Server 2005, though what's installed appears to be SQL Server 2008. I can imagine many people are completely green, don't know what Instance Names or IIS are really all about, and just want to write a little Web site with a database.
So here's what I tried:
The Wrox book recommended that if I had trouble establishing a connection to the DB, I read Chapter 18, which suggested I run the site under IIS, so I followed the instructions there. It didn't fix the problem.
The Wrox book recommended I read Appendix B -- configuring SQL Server. It talks first about named and unnamed instances and Windows vs SQL Server authentication, and gives examples of connection strings. My web.config file has simply <connectionStrings/> with no content.
So I look here and check the machine.config file in the Windows\Microsoft.NET folder and its connection string looks nothing like either. So I try setting the connect string in web-config to look like the one in machine.config, and that doesn't work. So I try deleting the one in machine.config so it looks like web.config and that doesn't work.
So I read somewhere another magical solution and go to the Options in VS and see the SQL Server Instance name is still set to SQLExpress, so I blank it out as recommended here and try both the above connection string options and that doesn't work.
So I see a recommendation to download SQL Server Management Studio, which I have and which I have installed, and so I'm went through the Wrox instructions for that. And that didn't work
So now I'm reading about 16,000 other threads trying to resolve this. Maybe I'll just toss this stupid Dell in the dumpster.
I must say, I really feel this is too much to ask of someone who just wants to learn to post a Web site with a little database like they have in the Wrox beginner book. It shouldn't be this hard. Maybe you have some IT guru at your workplace that you can ask to solve all your problems. (It infuriates me that the book keeps recommending that I contact my Network administrator... that would be me. I bought this laptop from Dell, and they didn't ship a network administrator with it.) So what the h??? I bought this thing for this purpose and I've spent a lot of money and tried really hard...
:-) :-) :-)
SO I'm prepared to buy your book, but at this point, I want a guarantee that after I've invested 120 hours reading and absorbing it, it WILL solve my problem, otherwise you'll fly out here personally and fix my Dell. What do you say?