When I attempt to run the Time Tracker Starter kit I receive the following error:
An attempt to attach an auto-named database for file C:\WebSites\Test_TimeTracker\App_Data\aspnetdb.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.
I checked SQL Express and I did originally have a database named aspnetdb that was installed by the QuickStarts. I have subsequently detached that database and moved the data and log files from SQL Express's data folder, however I still get the same error.
I've opened mdf file in visual studio and verified that it did indeed contain data and was not corrupt. The directory is not in a UNC Share. I've granted full security access on the WebSites directory to the "Everyone" user.
I'm running Windows 2003 Standard Edition, using Visual Studio Team Suite, running under beta 2 of the Framework.
I imagine that I could attach the mdf in Sql Express and then rewrite the ConnectionString to point to that, but I'd like to get it to work the way it was intended. I've attached the Connection String section as well as the stack trace below. Does anyone have any ideas about how to fix this issue?
<connectionStrings>
<add name="aspnet_staterKits_Test_TimeTracker" connectionString="Data Source=.\SQLExpress;Integrated Security=True;AttachDBFilename=|DataDirectory|aspnetdb.mdf;"/>
<remove name="LocalSqlServer"/>
<add name="LocalSqlServer"connectionString="Data Source=.\SQLExpress;Integrated Security=True;AttachDBFilename=|DataDirectory|aspnetdb.mdf;"/>
</connectionStrings>
[SqlException (0x80131904): An attempt to attach an auto-named database for file C:\WebSites\Test_TimeTracker\App_Data\aspnetdb.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.]
System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +684979
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +207
System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +1751
System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean enlistOK) +32
System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance) +601
System.Data.SqlClient.SqlInternalConnectionTds..ctor(SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance) +159
System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection) +346
System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options) +28
System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject) +445
System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject) +66
System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) +304
System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +85
System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +105
System.Data.SqlClient.SqlConnection.Open() +111
System.Web.DataAccess.SqlConnectionHolder.Open(HttpContext context, Boolean revertImpersonate) +126
System.Web.DataAccess.SqlConnectionHelper.GetConnection(String connectionString, Boolean revertImpersonation) +226
System.Web.Security.SqlRoleProvider.RoleExists(String roleName) +467
System.Web.Security.Roles.RoleExists(String roleName) +196
ASP.Global_asax.Application_Start(Object sender, EventArgs e) in c:\WebSites\Test_TimeTracker\Global.asax:13
-Rich
Rich Czyzewski
Software Architect
Jacksonville, Florida
Check out my .NET 2.0 Website WebJots (Starter Kit Available)
My Blog - Beta 2 Stuff, ASP.NET, etc.