I have a Windows Forms application that uses LocalDb and DbContext. This works fine on my development box but I have not been able to get it to work when deployed to another box.
In my app.config, I instantiate a named LocalDb instance in with:
<system.data.localdb>
<localdbinstances>
<add name="LocalProvergience" version="11.0" />
</localdbinstances>
</system.data.localdb>
My connection string in is:
<add name="LocalProvergienceEntities"
connectionString="metadata=res://*/ProvergienceModel.csdl|
res://*/ProvergienceModel.ssdl|
res://*/ProvergienceModel.msl;
provider=System.Data.SqlClient;
provider connection string="data source=(localdb)\LocalProvergience;
initial catalog=LocalProvergience;integrated security=True;
multipleactiveresultsets=True;
App=EntityFramework""
providerName="System.Data.EntityClient" />
If I include:
AttachDbFilename=|DataDirectory|\LocalProvergience.mdf;
in the connection string, I get an "Invald key value for attachdbfilename" error.
If I exclude AttachDbFilename, I get "A network-related or instance-specific error occurred while establishing a connection to a SQL server" error.
Several questions:
The providerName is set to "System.Data.EntityClient" should this be "System.Data.LocalDb"?
- Would anyone be able to post or direct me to an example of a correct app.config for LocalDb and DbContext?