I am having a great deal of difficulty connecting my version of visual web developer 2005 express to the AspNetSqlProvider as stated in the tutorials online at the web developer center. I keep getting the error below.
"Could not establish a connection to the database.
If you have not yet created the SQL Server database, exit the Web Site Administration tool, use the aspnet_regsql command-line utility to create and configure the database, and then return to this tool to set the provider. "
When I run the utility I still get a connection error using the hostname of my computer and windows authentication.
The setup failed message is as below also:-
"Setup failed.
Exception:
Unable to connect to SQL Server database.
-
Details of failure
-
System.Web.HttpException: Unable to connect to SQL Server database. > 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: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
at System.Data.SqlClient.TdsParser.Connect(Boolean& useFailoverPartner, Boolean& failoverDemandDone, String host, String failoverPartner, String protocol, SqlInternalConnectionTds connHandler, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, SqlConnection owningObject, Boolean aliasLookup)
at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance)
at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance)
at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection)
at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options)
at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject)
at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject)
at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject)
at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
at System.Data.SqlClient.SqlConnection.Open()
at System.Web.Management.SqlServices.GetSqlConnection(String server, String user, String password, Boolean trusted, String connectionString)
End of inner exception stack trace
at System.Web.Management.SqlServices.GetSqlConnection(String server, String user, String password, Boolean trusted, String connectionString)
at System.Web.Management.SqlServices.SetupApplicationServices(String server, String user, String password, Boolean trusted, String connectionString, String database, String dbFileName, SqlFeatures features, Boolean install)
at System.Web.Management.SqlServices.Install(String database, SqlFeatures features, String connectionString)
at System.Web.Management.ConfirmPanel.Execute()"
I have tried some of the suggestions on the forum with no result
Please can you help
Do you in fact have a SQL Server installed?
If you installed SQL Server Express, the 'computer name' to use is probably [ .\SQLEXPRESS ]
Have you tried [ (local) ]
If you have NOT installed SQL Server, you can download (and then install) a free copy of SQL Server 2005 Express here.
|||Thanks for the reply.
I do have SQL Server Express installed since I can open the configuration tool
|||Arnie,
Thanks for the info again. I tried it using the aspnet_regsql tool and got a successfult database creation so that worked fine. The only problem now is that the Web Admin tool within Visual web Developer it is saying that the server path is
[Hostname]\John Brindle rather than [Hostname]\SQLEXPRESS which is what it needs to be I guess. Do you know how I change this so I can get a good connection test using the tool and thus be able to use the database with Visual Web Developer?
Regards
John
|||I am facing the same problem but I have not installed SQL Server 2005 Express Edition
I have SQL Server 2005 Enterprise edition.
I have tried using the aspnet_regsql utility that creates the aspnetdb but I am unable to see its instance in tha app_dev folder
and I am unable to connect to it ...
Any suggestions ?
|||Sorry have no suggestions. My problem seems tro be more basic than even getting the database created which I can now do by specifiying [Hostname of my pc]\SQLEXPRESS as the server path. MY problem is I cannot do a test connection to the database and thuis use it.|||I have the same problem, I'm using Windows Vista Home Premium, I can establish a connection from the Database Explorer but when using the ASP.NET configuration I get the message:
Could not establish a connection to the database.
If you have not yet created the SQL Server database, exit the Web Site Administration tool, use the aspnet_regsql command-line utility to create and configure the database, and then return to this tool to set the provider.
I have ran the aspnet_regsql and changed the host to <pcname>\sqlexpress but get the same exact error. Weird because I don't have that problem with my XP machine at work. Any suggestions?
thanks
|||Ok, I found the solution for not beeing able to use SQL on the webdeveloper. The issue is that SQL Server (express or full version) does not allow user instances to be run by default, when trying to use the security option in webdeveloper a database file (.mdf) is created and a new user instances outside the server is created.
Ok, enough explanation, the solution: open sql management studio and open the master database, make a new query and type sp_configure 'user instances enabled','1' execute this , then type reconfigure and execute this too so the changes take effect. For more information on sp_configure you can read http://msdn2.microsoft.com/en-us/library/ms188787.aspx if you wish to list all the configuration then execute sp_configure without any parameters.
Hope it helps and good luck.
|||AngelX, my last hope before I call Microsoft.
I'm running Vista and SQL 2005 Developer.
I don't have ' user instances enabled' to set?
Regards
Phil
|||Phillip,
Open the Microsoft SQL Server Manager Studio (in my case I have the Manager Studio Express version), connect to you database and make a new query with your current connection, then execute the following sp_configure, in the query result tab a list like the following should appear:
Name
Minimum
Maximum
Config_value
Run_value
allow updates
0
1
0
0
clr enabled
0
1
0
0
cross db ownership chaining
0
1
0
0
default language
0
9999
0
0
max text repl size (B)
0
2147483647
65536
65536
nested triggers
0
1
1
1
remote access
0
1
1
1
remote admin connections
0
1
0
0
remote login timeout (s)
0
2147483647
20
20
remote proc trans
0
1
0
0
remote query timeout (s)
0
2147483647
600
600
server trigger recursion
0
1
1
1
show advanced options
0
1
0
0
user instances enabled
0
1
1
1
user options
0
32767
0
0
If you see the list then you're in business, type sp_configure "user instances enabled", 1 and execute this, then execute reconfigure so the changes take effect.
Hope it helps.
No comments:
Post a Comment