I built a C# application in Visual Studio with Linq-to-SQL and it contains a service-based database (`.mdf` file). I want to deploy it to another computer so it can be used there. 

I have already created the setup installer using Visual Studio installer -> Setup project in my solution. I try to install it in another computer. After the installation is completed, I can open the application. 

But when I want to access the database I get this error:

> 
> Microsoft .NET Framework: Unhandled exception has occurred in your application. If you click continue, the application will ignore this error and attempt to continue. If you click quit, the application will close immediately.
> 
> 
> The underlying provider failed on open.
> 
> 
> 

Can anyone help? I'm new to C# programming, I use Microsoft SQL Server 2012 Express and Visual Studio 2015. Thank you

Here's the error log:

`See the end of this message for details on invoking just-in-time (JIT) debugging instead of this dialog box.

\*\*\*\*\*\*\*\*\*\*\*\*\*\* Exception Text \*\*\*\*\*\*\*\*\*\*\*\*\*\* System.Data.Entity.Core.EntityException: The underlying provider failed on Open. ---> System.Data.SqlClient.SqlException: An attempt to attach an auto-named database for file C:\Program Files\Techno zone\LocalACC\Database1.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.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData, DbConnectionPool pool, String accessToken, Boolean applyTransientFaultHandling) at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions) at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool pool, DbConnection owningObject, DbConnectionOptions options, DbConnectionPoolKey poolKey, DbConnectionOptions userOptions) at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection) at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection) at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection) at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection) at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection) at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions) at System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource`1 retry) at System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry) at System.Data.SqlClient.SqlConnection.Open() at System.Data.Entity.Infrastructure.Interception.InternalDispatcher`1.Dispatch[TTarget,TInterceptionContext](TTarget target, Action`2 operation, TInterceptionContext interceptionContext, Action`3 executing, Action`3 executed) at System.Data.Entity.Infrastructure.Interception.DbConnectionDispatcher.Open(DbConnection connection, DbInterceptionContext interceptionContext) at System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.<>c__DisplayClass1.<Execute>b__0() at System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.Execute[TResult](Func`1 operation) at System.Data.Entity.Core.EntityClient.EntityConnection.Open() --- End of inner exception stack trace --- at System.Data.Entity.Core.EntityClient.EntityConnection.Open() at System.Data.Entity.Core.Objects.ObjectContext.EnsureConnection(Boolean shouldMonitorTransactions) at System.Data.Entity.Core.Objects.ObjectContext.ExecuteInTransaction[T](Func`1 func, IDbExecutionStrategy executionStrategy, Boolean startLocalTransaction, Boolean releaseConnectionOnSuccess) at System.Data.Entity.Core.Objects.ObjectQuery`1.<>c\_\_DisplayClass7.b\_\_5() at System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.Execute[TResult](Func`1 operation) at System.Data.Entity.Core.Objects.ObjectQuery`1.GetResults(Nullable`1 forMergeOption) at System.Data.Entity.Core.Objects.ObjectQuery`1..GetEnumerator>b\_\_0() at System.Data.Entity.Internal.LazyEnumerator`1.MoveNext() at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source) at SmallProject.AllTransactionForm.btnShowAll\_Click(Object sender, EventArgs e) at System.Windows.Forms.Control.OnClick(EventArgs e) at System.Windows.Forms.Button.OnClick(EventArgs e) at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent) at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.ButtonBase.WndProc(Message& m) at System.Windows.Forms.Button.WndProc(Message& m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

\*\*\*\*\*\*\*\*\*\*\*\*\*\* Loaded Assemblies \*\*\*\*\*\*\*\*\*\*\*\*\*\* 
mscorlib
 Assembly Version: 4.0.0.0
 Win32 Version: 4.6.1532.0 built by: NETFXREL1LAST
 CodeBase: file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/mscorlib.dll
---------------------------------------- SmallProject
 Assembly Version: 1.0.0.0
 Win32 Version: 1.0.0.0
 CodeBase: file:///C:/Program%20Files/Techno%20zone/LocalACC/SmallProject.exe
---------------------------------------- System.Windows.Forms
 Assembly Version: 4.0.0.0
 Win32 Version: 4.6.1532.0 built by: NETFXREL1LAST
 CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC\_MSIL/System.Windows.Forms/v4.0\_4.0.0.0\_\_b77a5c561934e089/System.Windows.Forms.dll
---------------------------------------- System
 Assembly Version: 4.0.0.0
 Win32 Version: 4.6.1532.0 built by: NETFXREL1LAST
 CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC\_MSIL/System/v4.0\_4.0.0.0\_\_b77a5c561934e089/System.dll
---------------------------------------- System.Drawing
 Assembly Version: 4.0.0.0
 Win32 Version: 4.6.1532.0 built by: NETFXREL1LAST
 CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC\_MSIL/System.Drawing/v4.0\_4.0.0.0\_\_b03f5f7f11d50a3a/System.Drawing.dll
---------------------------------------- System.Configuration
 Assembly Version: 4.0.0.0
 Win32 Version: 4.6.1532.0 built by: NETFXREL1LAST
 CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC\_MSIL/System.Configuration/v4.0\_4.0.0.0\_\_b03f5f7f11d50a3a/System.Configuration.dll
---------------------------------------- System.Core
 Assembly Version: 4.0.0.0
 Win32 Version: 4.6.1532.0 built by: NETFXREL1LAST
 CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC\_MSIL/System.Core/v4.0\_4.0.0.0\_\_b77a5c561934e089/System.Core.dll
---------------------------------------- System.Xml
 Assembly Version: 4.0.0.0
 Win32 Version: 4.6.1532.0 built by: NETFXREL1LAST
 CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC\_MSIL/System.Xml/v4.0\_4.0.0.0\_\_b77a5c561934e089/System.Xml.dll
---------------------------------------- EntityFramework
 Assembly Version: 6.0.0.0
 Win32 Version: 6.1.40302.0
 CodeBase: file:///C:/Program%20Files/Techno%20zone/LocalACC/EntityFramework.DLL
---------------------------------------- System.Data
 Assembly Version: 4.0.0.0
 Win32 Version: 4.6.1532.0 built by: NETFXREL1LAST
 CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC\_64/System.Data/v4.0\_4.0.0.0\_\_b77a5c561934e089/System.Data.dll
---------------------------------------- EntityFramework.SqlServer
 Assembly Version: 6.0.0.0
 Win32 Version: 6.1.40302.0
 CodeBase: file:///C:/Program%20Files/Techno%20zone/LocalACC/EntityFramework.SqlServer.DLL
---------------------------------------- Anonymously Hosted DynamicMethods Assembly
 Assembly Version: 0.0.0.0
 Win32 Version: 4.6.1532.0 built by: NETFXREL1LAST
 CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC\_64/mscorlib/v4.0\_4.0.0.0\_\_b77a5c561934e089/mscorlib.dll
---------------------------------------- System.Numerics
 Assembly Version: 4.0.0.0
 Win32 Version: 4.6.1532.0 built by: NETFXREL1LAST
 CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC\_MSIL/System.Numerics/v4.0\_4.0.0.0\_\_b77a5c561934e089/System.Numerics.dll
---------------------------------------- System.Data.OracleClient
 Assembly Version: 4.0.0.0
 Win32 Version: 4.6.1532.0 built by: NETFXREL1LAST
 CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC\_64/System.Data.OracleClient/v4.0\_4.0.0.0\_\_b77a5c561934e089/System.Data.OracleClient.dll
---------------------------------------- System.Transactions
 Assembly Version: 4.0.0.0
 Win32 Version: 4.6.1532.0 built by: NETFXREL1LAST
 CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC\_64/System.Transactions/v4.0\_4.0.0.0\_\_b77a5c561934e089/System.Transactions.dll
---------------------------------------- System.Xml.Linq
 Assembly Version: 4.0.0.0
 Win32 Version: 4.6.1532.0 built by: NETFXREL1LAST
 CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC\_MSIL/System.Xml.Linq/v4.0\_4.0.0.0\_\_b77a5c561934e089/System.Xml.Linq.dll
---------------------------------------- System.EnterpriseServices
 Assembly Version: 4.0.0.0
 Win32 Version: 4.6.1532.0 built by: NETFXREL1LAST

 CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC\_64/System.EnterpriseServices/v4.0\_4.0.0.0\_\_b03f5f7f11d50a3a/System.EnterpriseServices.dll
------------------------------------------------------------------------------------------------------------------------------------------------------

\*\*\*\*\*\*\*\*\*\*\*\*\*\* JIT Debugging \*\*\*\*\*\*\*\*\*\*\*\*\*\* To enable just-in-time (JIT) debugging, the .config file for this application or computer (machine.config) must have the jitDebugging value set in the system.windows.forms section. The application must also be compiled with debugging enabled.

For example:

When JIT debugging is enabled, any unhandled exception will be sent to the JIT debugger registered on the computer rather than be handled by this dialog box.`