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 (EDM) supports SQLite, so it was converted quickly. Complete development and test on the development machine. Deploy it to the official environment and start to see "The specified storage zone providesProgramCannot 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, I set <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 is also added to the machine in the production environment. in config, run the test program. The SQLite item appears in dbproviderfactories. the datatable of getfactoryclasses () indicates 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. On the Development machine, c: \ Program Files \ microsoft sdks \ windows \ v6.0a \ binfind A gacutil.exe. Check that this version is 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.
This article from the csdn blog, reproduced please indicate the source: http://blog.csdn.net/liufan76/archive/2008/10/29/3173282.aspx