Guillaume Filion
Guillaume Filion

Reputation: 510

MissingMethodException: Void System.Data.Entity.Infrastructure.LocalDbConnectionFactory..ctor() after upgrading EF6

I upgraded EF6 from 6.2.0 to 6.3.0 and now I'm getting this error on the server (not in Visual Studio):

Méthode introuvable : 'Void System.Data.Entity.Infrastructure.LocalDbConnectionFactory..ctor()'. Description : Une exception non gérée s'est produite au moment de l'exécution de la requête Web actuelle. Contrôlez la trace de la pile pour plus d'informations sur l'erreur et son origine dans le code.

Détails de l'exception: System.MissingMethodException: Méthode introuvable : 'Void System.Data.Entity.Infrastructure.LocalDbConnectionFactory..ctor()'.

I even tried to publish the old version of the website (using EF 6.2.0) and I'm still getting the same error.

The server is Windows Server 2012 with asp.net framework 4.8. The website is made with WebForms. I tried restarting IIS and the server itself, without success.

Upvotes: 4

Views: 3481

Answers (2)

1_bug
1_bug

Reputation: 5727

For anyone who has same problem during development, not deploying:

Probably, your project reads EntityFramework.dll from different place than your project bin folder. You can check this in Modules window (for open it start debugging and choose Debug -> Windows -> Modules). Now, just find there an entry for EntityFramework.dll and check out the path value. In my case it pointed out an old version from GAC_MSIL directory. After deletion these trash from GAC and re-running my project, file EntityFrmaework.dll was loaded from my project folder and the error was gone.

Upvotes: 2

Guillaume Filion
Guillaume Filion

Reputation: 510

I was able to fix the problem by publishing with the option to "delete existing files".

I guess it was different versions of the EntityFramework DLL that were conflicting on the server.

Upvotes: 6

Related Questions