Folks, I've returned to attempting to deploy my apps that use Entity
Framework 4 and SQLite. I am now down to one consistent error in all cases
on the Win 2008 Std server. This stack trace excerpt show what's happening:
System.ArgumentException: The specified store provider cannot be found in
the configuration, or is not valid.
---> System.ArgumentException: Unable to find the requested .Net Framework
Data Provider. It may not be installed.
at System.Data.Common.DbProviderFactories.GetFactory(String
providerInvariantName)
at System.Data.EntityClient.EntityConnection.GetFactory(String
providerString)
at
System.Data.EntityClient.EntityConnection.ChangeConnectionString(String
newConnectionString)
at System.Data.Objects.ObjectContext.CreateEntityConnection(String
connectionString)
I don't know who to blame for this. So I wrote a little sanity check app
that used different techniques to see what did and didn't work:
- Plain traditional ADO.NET calls to a SQLite DB are okay.
- LINQ queries on an Entity Framework context to a SQL Server DB are okay.
- LINQ queries on an Entity Framework context to a SQLite DB fail.
So it seems that only EF and SQLite combined seem to fail, but I still can't
tell who is to blame or what to do. Web searches hint that I need to define
a factory in my App.config files by adding these lines:
<system.data>
<DbProviderFactories>
<remove invariant="System.Data.SQLite"/>
<add name="SQLite Data Provider" invariant="System.Data.SQLite"
description=".Net Framework Data Provider for SQLite"
type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite" />
</DbProviderFactories>
</system.data>
This has no effect on my dev machine, but on the server it changes the crash
to:
A null was returned after calling the 'GetService' method on a store
provider instance of type 'System.Data.SQLite.SQLiteFactory'. The store
provider might not be functioning correctly.
I'm completely flummoxed by this problem. Does anyone have helpful advice?
Greg