While
using “sqlite” one can encounter error “failed to find or load the registered
.net framework data provider.”
We can
solve the issue by taking care of following things:
Fix your
DbProviderFactories entry in the config file (i.e. web.config or app.config) to
reference the full (version and public key information) assembly name
instead of the partial assembly name. A full reference allows .NET to search
the GAC for SQLite.
Here's a
"full" reference example:
<DbProviderFactories>
<add name="SQLite Data
Provider" invariant="System.Data.SQLite"
description=".Net Framework Data
Provider for SQLite"
type="System.Data.SQLite.SQLiteFactory,
System.Data.SQLite, Version=1.0.27.1,
Culture=neutral,PublicKeyToken=db937bc2d44ff139"/>
</DbProviderFactories>
|
However,
if you're deploying to a production machine without access to the machine's GAC
or the ability to register a provider on the GAC on the destination machine, then
add reference of SQLite dll in your application as:
Right-click
on "bin" -> select "Add Existing item", then browse for
System.Data.SQLite.DLL and add it. Now you can leave the partial reference in
the config file like you had it before, and SQLite's DLL gets copied out to the
webserver when you deploy.
Note: If you want to install SQLite
package on your local system for testing, download and install from here. Setup
is available for all .Net Framework versions and includes all necessary dlls.
Thanx, this has solved by issue!
ReplyDelete