2010-10-31 10 views
1

Voici une capture d'écran de l'erreur:ArgumentException était unhandled

alt text

L'erreur est lui-même:

La connexion du nom spécifié est introuvable dans la configuration, et non destiné à être utilisé avec le Fournisseur EntityClient ou non valide.

Aller au fichier app.config de ce même projet, je peux trouver:

<?xml version="1.0" encoding="utf-8"?> 
<configuration> 
    <connectionStrings> 
    <add name="DocumentsEntities" connectionString="metadata=res://*/Documents.csdl|res://*/Documents.ssdl|res://*/Documents.msl;provider=System.Data.SQLite;provider connection string='data source=&quot;D:\Programming Projects\Desktop Applications\C#\DocumentScanner\DAL\Documents.sqlite&quot;'" providerName="System.Data.EntityClient" /> 
    </connectionStrings> 
</configuration> 

La chaîne de connexion existe mais que je reçois cette erreur. Je utilise SQLite et .NET Framework 3.5.

Des suggestions?

+0

Avez-vous déjà régler cette question avec succès? Avez-vous encore besoin d'aide pour cela? – jcolebrand

Répondre

0

Avez-vous trouvé cette réponse? Aide-t-il?

http://social.msdn.microsoft.com/forums/en-US/adodotnetentityframework/thread/f5904b4d-b2f8-421e-90de-339f93959533/

cite:

My only guess is the app.config is not in the binary directory where the exe is. Please do the following: 1. Visually verify that the app.config with the expected content is in the directory where the exe is compiled. (Existence in the project root directory is not enough.) 2. Use System.Configuration.ConfigurationManager from within your app to examine the content of the app.config your exe is using. I’m also looking at the content of the connection string, and I can say that it may not work in a multi project environment (unless you’ve duplicated the EDM in each project). The reason for that is “.” resolves to the directory where the exe is loaded from. If you want to reuse the same EDM, you at least have to make a few steps back in the path and then navigate to the project where the EDM is, e.g. “......\Proj1\AdventureWorksModel”. Additionally you may consider using the |DataDirectory| macro - when you load an AppDomain you can set |DataDirectory| to point to the exact directory where the EDM is, and then use that in the connection string, e.g.

“|DataDirectory|\AdventureWorksModel”. If you are working on an ASP.NET project, you can use “~” which refers to the project root. In that latter case, you can’t reference a model outside your project’s hierarchy though.

Zlatko Michailov Program Manager, 

Data Programmability Runtime Microsoft Corp.