1: when using the SQLite database, it is often unable to connect to the database. In this case, check SQLite. whether the DLL has been referenced, and whether the version of the added DLL is consistent with the SQLite version used.
These two DLL files are references that must be added when SQLite is used,
2: in order not to find the database after SQLite is released, you need to manually set the two DLL files to be automatically copied to the local device.
Right-click and choose "attribute">"
3: For published websites, remember to add the following nodes under the Web. config file to access the SQLite database correctly.
<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>
4: the database is stored in the app_data directory. When the file is published, the address of the referenced file is not an absolute path and cannot be accessed:
<Connectionstrings>
<Add name = "dbentities" connectionstring = "metadata = Res: // */models. dbmodel. CSDL | res: // */models. dbmodel. SSDL | res: // */models. dbmodel. MSL; provider = system. data. SQLite; provider connection string = & quot;Data Source = | datadirectory | \ dB. DB & quot ;"Providername = "system. Data. entityclient"/>
</Connectionstrings>
5: When you configure an x64 machine today, the SQLite error is reported, "cocould not load file or assembly 'System. data. SQLite 'or one of its dependencies. incorrect loading formatProgram."
At first, I thought that the SQLite database could not be connected or the dll version was faulty. Later I discovered that,System. Data. SQLite is divided into x86 and x64 operating system versions. ThereforeApplication poolWin32 compatibility should be selected;
Error:
The procedure is as follows:
In the IIS manager, select application pool-click Advanced settings for the application pool in use-enable the 32-bit application to true.
At this time, the page is refreshed and the error is removed.