i am the same connection errors but i do not have SQLEXPRESS in my config file. I connect to two sql servers without issues from my local machine (running developer edition).
I DO notice that the asp.net properties on IIS6 holds data source=./SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true
This is the error i am getting. This is the first time i have published an app to the web using ASP.net. I used the copy website feaure in VS2008, this is all i have done so far and i receive this error.
Server Error in '/' Application.
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)
Description:
An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: 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)
Source Error:
Line 11: if (Roles.Enabled) Line 12: { Line 13: if (!Roles.RoleExists("ProjectAdministrator")) Line 14: { Line 15: Roles.CreateRole("ProjectAdministrator");
deektweek
Member
6 Points
14 Posts
Re: Connection string in WEB.CONFIG for SQL Server 2005
Feb 26, 2008 10:10 AM|LINK
i am the same connection errors but i do not have SQLEXPRESS in my config file. I connect to two sql servers without issues from my local machine (running developer edition).
I DO notice that the asp.net properties on IIS6 holds data source=./SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true
Could this be the issue and why is it there?
chetan.sarod...
All-Star
65749 Points
11148 Posts
Re: Connection string in WEB.CONFIG for SQL Server 2005
Feb 27, 2008 02:37 AM|LINK
Change in connectionString User Instance = false
<connectionStrings>
<add name="aspnet_staterKits_TimeTracker" connectionString="Data Source=RELSEC_FE\SQLServer2005;Integrated Security=True;AttachDBFilename=|DataDirectory|TimeTracker.mdf;User Instance=false"/>
<remove name="LocalSqlServer"/>
<add name="LocalSqlServer" connectionString="Data Source=RELSEC_FE\SQLServer2005;Integrated Security=True;AttachDBFilename=|DataDirectory|TimeTracker.mdf;User Instance=false"/>
</connectionStrings>
Senior Software Engineer,
Approva Systems Pvt Ltd, Pune, India.
Geek-O
Member
11 Points
29 Posts
Re: Connection string in WEB.CONFIG for SQL Server 2005
Apr 28, 2008 12:24 PM|LINK
This is the error i am getting. This is the first time i have published an app to the web using ASP.net. I used the copy website feaure in VS2008, this is all i have done so far and i receive this error.
Server Error in '/' Application.
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)
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.Exception Details: System.Data.SqlClient.SqlException: 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)
Source Error:
Source File: d:\hshome\voobiz\corp.voobon.net\Global.asax Line: 13
This is my config file:
<?xml version="1.0"?><configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
<connectionStrings>
<add name="aspnet_staterKits_TimeTracker" connectionString="Data Source=.\SQLExpress;Integrated Security=True;AttachDBFilename=|DataDirectory|TimeTracker.mdf;User Instance=true" />
<remove name="LocalSqlServer"/>
<add name="LocalSqlServer" connectionString="Data Source=.\SQLExpress;Integrated Security=True;AttachDBFilename=|DataDirectory|TimeTracker.mdf;User Instance=true" />
</connectionStrings>
<system.web>
<siteMap defaultProvider="AspNetXmlSiteMapProvider" enabled="true">
<providers>
<clear />
<add name="AspNetXmlSiteMapProvider"
type="System.Web.XmlSiteMapProvider, System.Web, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
siteMapFile="web.sitemap"
securityTrimmingEnabled="true" />
</providers>
</siteMap>
<authentication mode="Forms">
<forms loginUrl="~/TimeTracker/login.aspx"/>
</authentication>
<compilation debug="true" />
<customErrors mode="Off"/>
<machineKey decryptionKey="AutoGenerate,IsolateApps"/>
<roleManager enabled="true" />
</system.web>
</configuration>
chetan.sarod...
All-Star
65749 Points
11148 Posts
Re: Connection string in WEB.CONFIG for SQL Server 2005
Jun 19, 2008 03:27 AM|LINK
You have to register your DB with ASP.NET Membership classes by executing the command line utility in VS prompt
aspnet_regsql, it will open one window, where you have to configure DB.
Add the following lines under <system.web>
<membership> <providers> <remove name="AspNetSqlMembershipProvider" /> <add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" connectionStringName="vsItemsConnectionString" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="true" applicationName="/" requiresUniqueEmail="false" passwordFormat="Hashed" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="7" minRequiredNonalphanumericCharacters="1" passwordAttemptWindow="10" passwordStrengthRegularExpression="" /> </providers> </membership> <profile> <providers> <remove name="AspNetSqlProfileProvider" /> <add name="AspNetSqlProfileProvider" connectionStringName="vsItemsConnectionString" applicationName="/" type="System.Web.Profile.SqlProfileProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> </providers> </profile> <roleManager> <providers> <remove name="AspNetSqlRoleProvider" /> <add name="AspNetSqlRoleProvider" connectionStringName="vsItemsConnectionString" applicationName="/" type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> </providers> </roleManager>Senior Software Engineer,
Approva Systems Pvt Ltd, Pune, India.
snovice
Member
105 Points
225 Posts
Re: Connection string in WEB.CONFIG for SQL Server 2005
Jun 19, 2008 08:23 AM|LINK
Hi All thanks for your Answers.
sorry for not replying
but my problem is solved without changing the code.
i have to change my hosting sevices.
my earlier host has not yet refunded my money and neither released my domain name till now.
but with new hosting servie i had registered a new domain name.
thanks all for your help/contribution.
chetan.sarod...
All-Star
65749 Points
11148 Posts
Re: Connection string in WEB.CONFIG for SQL Server 2005
Jun 20, 2008 03:21 AM|LINK
If your problem has been solved then please mark the post as answer
So other people can help it
Senior Software Engineer,
Approva Systems Pvt Ltd, Pune, India.
deektweek
Member
6 Points
14 Posts
Re: Connection string in WEB.CONFIG for SQL Server 2005
Jun 20, 2008 08:48 AM|LINK
thanks for all the help, my issue is resolved
chetan.sarod...
All-Star
65749 Points
11148 Posts
Re: Connection string in WEB.CONFIG for SQL Server 2005
Jun 23, 2008 03:22 AM|LINK
Please mark it as answer so it will help for other people
Senior Software Engineer,
Approva Systems Pvt Ltd, Pune, India.
chetan.sarod...
All-Star
65749 Points
11148 Posts
Re: Connection string in WEB.CONFIG for SQL Server 2005
Aug 06, 2008 03:27 AM|LINK
As far i am concerned the error means that "It is not allowing remote connections"
So i think the solution is if you are using Express edition
Go to the Configuration Manager and open it.
After openeing there will be two attributes by name SQL Server(Browser),SQL Server
right click on it and click Stop and restart both of the services
Then check the properties part and everything works fine or not
Let me know if this helps you
http://blogs.msdn.com/sql_protocols/archive/2005/10/22/sql-server-2005-connectivity-issue-troubleshoot-part-i.aspx
Have a look at the following KB article, it will take you through the process of allowing remote connections.
How to configure SQL Server 2005 to allow remote conections
http://support.microsoft.com/default.aspx?scid=kb;EN-US;914277
http://blogs.msdn.com/sql_protocols/archive/2007/03/31/named-pipes-provider-error-40-could-not-open-a-connection-to-sql-server.aspx
http://blogs.msdn.com/sql_protocols/archive/2007/05/13/sql-network-interfaces-error-26-error-locating-server-instance-specified.aspx
Senior Software Engineer,
Approva Systems Pvt Ltd, Pune, India.
avimau12
Member
2 Points
1 Post
Re: Connection string inasp.net for SQL Server 2005
Aug 21, 2009 12:20 PM|LINK