Recently, we have developed a small application that uses SQLite as a database. When we started using dblinq, there was an unsupported problem when we made a LINQ query. Later I saw that Entity Framework supports SQLite, so it was quickly converted. Complete development and test on the development machine. When deployed to the official environment, the following error occurs: "The specified storage zone provider cannot be found in the configuration, or it is invalid ." ----> "Find the. NET Framework data provider that is not requested. May not be installed ".
This problem is very strange because the sqlite.net installation package is also running on the production machine.
After running a test program, output the datatable of dbproviderfactories. getfactoryclasses () and find that the data provider in the production environment does not have SQLite.
I checked it online and found someone prompted:
1. Add the following to the Web. config file:
<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,
Version = 1.0.57.0, culture = neutral, publickeytoken = db937bc2d44ff139"
/>
</Dbproviderfactories>
</System. Data>
2. Copy System. Data. SQLite. dll and system. Data. SQLite. LINQ. DLL files to the bin directory
As prompted by 1
<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.57.0, culture = neutral, publickeytoken = db937bc2d44ff139"
/> This configuration item is also added to machine. config in the production environment, and then run the test program. The SQLite item appears in the datatable of dbproviderfactories. getfactoryclasses (), indicating that the configuration is correct.
However, when you run the program, the following error occurs: "The bucket provider of the" system. Data. SQLite. sqlitefactory "type calls the" getservice "method and returns NULL. The Storage Area provider may not run properly ".
It took a while to study the "Storage zone", but it was useless.
Suddenly, the GAC in the production environment does not have system. Data. SQLite. is the problem here?
After gacutil.exe under v1.1.xxxis run in the production environment, the error "unknown" is returned. I checked it online again. It is said that gacutil has something to do with the Framework version. Find a gacutil.exe file on the C:/program files/Microsoft sdks/Windows/v6.0a/bind on the development machine. Check that this is version 3.5. Copy to the production environment, register system. Data. SQLite. dll and system. Data. SQLite. LINQ. dll, and run the program: everything is normal! Success!
The problem is summarized as follows:
1 GAC does not register system. Data. SQLite. dll and system. Data. SQLite. LINQ. dll.
2 dbproviderfactories in machine. config does not correctly add SQLite related items.