Answered by:
CreateUserWizard does not identify correct SQL Instance

Question
-
I am using Expression Web whilst following a vide course that shows how to construct an ASPX based web site.
I've set up the connection to the database as ConnectionString1 and the site is working.
I have now come to the point where I need to set up logins and have used the ASP.NET CreateUserWizard to create my test logins. However, when I invoke the facility, it does not work because it cannot find the Server/Instance specified. It want SQLExpress but I have SQL Server 2008R2 Developer edition with an instance of PRESARIO.
Could anyone guide me please.
I suspect that I need to modify the Web Config file which currently contains:
<configuration>
<connectionStrings>
<add name="ConnectionString1" connectionString="Data Source=PRESARIO;AttachDbFilename="C:\Documents and Settings\John Holmes\My Documents\Project Files - Advanced EW\Lesson 07\Snug As A Bug\App_Data\snug_as_a_bug.mdf";Integrated Security=True"
providerName="System.Data.SqlClient" />
<add name="Connection2" connectionString="Data Source=PRESARIO;AttachDbFilename="C:\Documents and Settings\John Holmes\My Documents\Project Files - Advanced EW\Lesson 07\Snug As A Bug\App_Data\snug_as_a_bug.mdf";Integrated Security=True"
providerName="System.Data.SqlClient" />
</connectionStrings>
</configuration>Error details:
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) body {font-family:"Verdana";font-weight:normal;font-size: .7em;color:black;} p {font-family:"Verdana";font-weight:normal;color:black;margin-top: -5px} b {font-family:"Verdana";font-weight:bold;color:black;margin-top: -5px} H1 { font-family:"Verdana";font-weight:normal;font-size:18pt;color:red } H2 { font-family:"Verdana";font-weight:normal;font-size:14pt;color:maroon } pre {font-family:"Lucida Console";font-size: .9em} .marker {font-weight: bold; color: black;text-decoration: none;} .version {color: gray;} .error {margin-bottom: 10px;} .expandable { text-decoration:underline; font-weight:bold; color:navy; cursor:hand; }
Server Error in '/' Application.
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)
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.
SQLExpress database file auto-creation error:
The connection string specifies a local Sql Server Express instance using a database location within the application's App_Data directory. The provider attempted to automatically create the application services database because the provider determined that the database does not exist. The following configuration requirements are necessary to successfully check for existence of the application services database and automatically create the application services database:
- If the application is running on either Windows 7 or Windows Server 2008R2, special configuration steps are necessary to enable automatic creation of the provider database. Additional information is available at: http://go.microsoft.com/fwlink/?LinkId=160102. If the application's App_Data directory does not already exist, the web server account must have read and write access to the application's directory. This is necessary because the web server account will automatically create the App_Data directory if it does not already exist.
- If the application's App_Data directory already exists, the web server account only requires read and write access to the application's App_Data directory. This is necessary because the web server account will attempt to verify that the Sql Server Express database already exists within the application's App_Data directory. Revoking read access on the App_Data directory from the web server account will prevent the provider from correctly determining if the Sql Server Express database already exists. This will cause an error when the provider attempts to create a duplicate of an already existing database. Write access is required because the web server account's credentials are used when creating the new database.
- Sql Server Express must be installed on the machine.
- The process identity for the web server account must have a local user profile. See the readme document for details on how to create a local user profile for both machine and domain accounts.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[SqlException (0x80131904): 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)] System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +5009598 System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning() +234 System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity) +341 System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, TimeoutTimer timeout, SqlConnection owningObject) +129 System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo serverInfo, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, TimeoutTimer timeout) +270 System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, TimeoutTimer timeout, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance) +195 System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance) +232 System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection) +5023255 System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup) +31 System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +76 System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +126 System.Data.SqlClient.SqlConnection.Open() +125 System.Web.Management.SqlServices.GetSqlConnection(String server, String user, String password, Boolean trusted, String connectionString) +82 [HttpException (0x80004005): Unable to connect to SQL Server database.] System.Web.Management.SqlServices.GetSqlConnection(String server, String user, String password, Boolean trusted, String connectionString) +137 System.Web.Management.SqlServices.SetupApplicationServices(String server, String user, String password, Boolean trusted, String connectionString, String database, String dbFileName, SqlFeatures features, Boolean install) +94 System.Web.Management.SqlServices.Install(String database, String dbFileName, String connectionString) +27 System.Web.DataAccess.SqlConnectionHelper.CreateMdfFile(String fullFileName, String dataDir, String connectionString) +395
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1Monday, August 9, 2010 12:43 PM
Answers
-
Hello,
Please, could uou tell us how the database has been created ?
Why have you AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true ?
In the 1st post i have seen "SQLExpress database file auto-creation error". This error is related to the use of user instance, a feature existing only in the SQL Server Express Edition. I suggest to ask to a moderator to move this thread towards the SQL Server Express Forum where this problem is really usual.
Have a nice day
PS : i suggest you to have a look in the SQL Server Express Blog ( you will find the link in one of the first posts of this forum : list of MSFT blogs )
Mark Post as helpful if it provides any help.Otherwise,leave it as it is.- Edited by Papy Normand Tuesday, August 10, 2010 8:30 PM link to post with the internal MSFT BLOGS
- Proposed as answer by Ed Price - MSFTMicrosoft employee Tuesday, April 16, 2013 4:47 PM
- Marked as answer by Ed Price - MSFTMicrosoft employee Saturday, April 27, 2013 4:35 AM
Tuesday, August 10, 2010 8:28 PM
All replies
-
<add name="Connection2" connectionString="Data Source=PRESARIO;AttachDbFilename="C:\Documents and
Please change the DataSoruce to ServerName/PRESARIO.
Pradeep Adiga
My blog: http://www.sqldbadiaries.comMonday, August 9, 2010 2:01 PM -
check what is the instance name installed in your machine.
you can go to the services and check the name or type SQLCMD -l -- to see the list of the sql servers installed in this machine.
Please mark the post as answered to help others to choose the best.
chandra sekhar pathivada | www.calsql.com (SQL Server Community Website)Monday, August 9, 2010 2:07 PM -
SQLCMD -L gives:
Servers:
PRESARIO
I also changed the Data Source to "ServerName/PRESARIO;" as recommended but there was no change in the result.
Monday, August 9, 2010 2:42 PM -
can you able to connect locally using sqlcmd utility.
sqlcmd S<servername> -E
Please mark the post as answered to help others to choose the best.
chandra sekhar pathivada | www.calsql.com (SQL Server Community Website)Monday, August 9, 2010 7:09 PM -
Yes I was able to connect locally.
I have connected to AdventureWorks as well as the mdf that came with the video that I am following. The problem is that the CreateUserWizard wants to connect to SQLExpress which I do not have. I did have it originally but have since replaced it with SQL SERVER 2008R2 Developer Edition.
I had various problems with the installation of 2008R2 because earlier versions had not been fully removed after I had attempted to do so using Add/Remove Programs. I have scanned the registry and found numerous references to SQLExpress.
Something is telling CreateUserWizard to connect to SQLExpress instead of PRESARIO but I can't see what. The only entry in the Web Config relates to the Connection Strings I have created and used successfully.
Tuesday, August 10, 2010 9:56 AM -
I've continued digging and suspect that the issue is in Machine.Config.
There are several directories under c:\WINDOWS\MICROSOFT.NET\Framework but the following have Connection strings that point to SQLEXPRESS.
My servername is PRESARIO so I think I need to edit the XML but I would be grateful for guidance and reassurance. Entries are:
C:\WINDOWS\MICROSOFT.NET\Framework\v.2.0.50727\CONFIG\machine.config
<connectionStrings>
<add name="LocalSqlServer" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User
Instance=true" providerName="System.Data.SqlClient"/>
</connectionStrings>
C:\WINDOWS\MICROSOFT.NET\Framework\v.4.0.30319\CONFIG\machine.config
<connectionStrings>
<add name="LocalSqlServer" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User
Instance=true" providerName="System.Data.SqlClient"/>
</connectionStrings>
Tuesday, August 10, 2010 10:45 AM -
I took the plunge and edited the data source to PRESARIO but I received a similar problem, even after a reboot so I still need help.............please.Tuesday, August 10, 2010 3:18 PM
-
Hello,
Please, could uou tell us how the database has been created ?
Why have you AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true ?
In the 1st post i have seen "SQLExpress database file auto-creation error". This error is related to the use of user instance, a feature existing only in the SQL Server Express Edition. I suggest to ask to a moderator to move this thread towards the SQL Server Express Forum where this problem is really usual.
Have a nice day
PS : i suggest you to have a look in the SQL Server Express Blog ( you will find the link in one of the first posts of this forum : list of MSFT blogs )
Mark Post as helpful if it provides any help.Otherwise,leave it as it is.- Edited by Papy Normand Tuesday, August 10, 2010 8:30 PM link to post with the internal MSFT BLOGS
- Proposed as answer by Ed Price - MSFTMicrosoft employee Tuesday, April 16, 2013 4:47 PM
- Marked as answer by Ed Price - MSFTMicrosoft employee Saturday, April 27, 2013 4:35 AM
Tuesday, August 10, 2010 8:28 PM -
Thanks.
I'm reluctant to have the thread switched to SQL Express because I do not have SQL SERVER Express. I have the Developer Edition for 2008R2.
The entry you queried was in the machine log and may have been placed there because I originally had SQL SERVER Express 2008R2 but uninstalled it prior to getting the Developer edition.
Wednesday, August 11, 2010 10:38 AM -
Still an issue?
Thanks!
Ed Price (a.k.a User Ed), SQL Server Customer Program Manager (Blog, Small Basic, Wiki Ninjas, Wiki)
Answer an interesting question? Create a wiki article about it!Tuesday, April 16, 2013 4:47 PM