Following Scott Hanselman's directions, I installed ELMAH on Microsoft SQL Server Compact 4.0 (SQL CE). Because of the dependency of 'ELMAH on MS SQL Server Compact' on SQL CE (and I already had the 'Manage NuGet Packages' window open) I let NuGet install it for me. NuGet installed everything perfectly and soon I was happily logging exceptions and storing them in a *.sdf file. Cool.
I also used NuGet to install Entity Framework 4.1 and followed Scott Guthrie's post on Code-First Development with Entity Framework 4. I created a model, added a connection string to my ASP.MVC 3 application, and soon I was persisting data to a second *.sdf file. Still cool.
Finally it was time to push my application to a server. This is where things became uncool.
After confirming that System.Data.SqlServerCe.Entity was in the bin directory, I started reviewing the versions of the SQL CE files, and then just to be sure I copied all of the files from my local installation of SQL CE to the server again. The problem still persisted.
Could not load file or assembly 'System.Data.SqlServerCe.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference.
I had used NuGet to install the version of SQL CE that ELMAH was using so I decided to research what the expected file versions were. These two great posts by ErikEJ caused me to formulate a theory that perhaps ELMAH and EF 4.1 were using the wrong or conflicting file versions. I made two changes to my application to test my theory.
- Altered DbProviderFactories in my web.config file as described in this article.
- Set up a binding redirect for System.Data.SqlServerCe as described in this article.
No comments:
Post a Comment