Clickonce deployment - An attempt to attach an auto-named database failed
I have an application which I wish to deploy using clickonce from a web server to a number of client machines using VS 2005 Beta 2. The application requires an SQL Server Express instance on client machines to manipulate user data.
When I publish my application to an apache web server the client machine is able to install the application with no problems. However whenever the application is loaded on the client machine I get the exception "An attempt to attach an auto-named database failed....". This exception does not occur in normal debugging.
It appears that it is trying to access a database file copied over to the client machine during the installation process in the directory: ...Local Settings/Apps/Data/WDWJC...etc. On examination of the specified folder the .mdf file exists. Also:,
-SQL server express is installed on the client machine
-The "User Instance" parameter of database's connection string is set to "true"
-In the project properties page the dataset and corresponding database files are included in the "Application Files..." on the project publish tab.
Can anyone help me with this problem? I have included the error log on the end of this thread.
Best Regards,
Duncan
System.Data.SqlClient.SqlException: An attempt to attach an auto-named database for file C:\Documents and Settings\enpdrc\Local Settings\Apps\Data\WDWJC29J.RZZ\1C13621C.9DV\cifl..tion_213110b321431b25_0001.0000_dd7859fb985de49f\Data\ciflex.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
at System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean enlistOK)
at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance)
at System.Data.SqlClient.SqlInternalConnectionTds..ctor(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 WindowsApplication1.Form1.LoadWatchers()
at WindowsApplication1.Form1.Form1_Load(Object sender, EventArgs e)
at System.Windows.Forms.Form.OnLoad(EventArgs e)
at System.Windows.Forms.Form.OnCreateControl()
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.WmShowWindow(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ContainerControl.WndProc(Message& m)
at System.Windows.Forms.Form.WmShowWindow(Message& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at WindowsApplication1.ciflex.Components.HotKey.HotKeyForm.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

