SQLite in Windows Server R2 Deployment FAQ Rollup [turn]

Source: Internet
Author: User

Rotate from: http://www.steveluo.name/sqlite-windows-server-2008-r2-deploy-faq/


Today it took a day to study SQLite to replace the Access databases used in some lightweight projects. The reason for this is to try out this popular lightweight file database, and on the other hand, to use Object Relational Mapping (ORM), SQLite's support is better than access.

First do a demo, do a simple select operation, but according to experience. NET application will always encounter this problem when deploying to the server, there is a series of problems. As for how SQLite is used, it is not within the scope of this discussion.

We are talking about issues that occur when you deploy to a server (Windows server R2) when both native development and debugging are complete.

The deployment steps for SQLite applications are the same as for normal applications (this should be the case, otherwise how lightweight?). ), but you may encounter a series of problems, the following issues I experienced during deployment, the test server is a completely new deployment of Windows Server R2.

1. The namespace "System.Data" does not exist in the type or namespace name "SQLite" (is the assembly reference missing?)

Please check to see if the System.Data.SQLite.dll is placed in the bin directory. This machine can be debugged properly because it adds a DLL reference under the SQLite installation directory. > sqlite.net Download page

2. Failed to load file or assembly "System.Data.SQLite.Linq" or one of its dependencies. The runtime that generated this assembly is newer than the currently loaded run and cannot load this assembly.

The problem is that the server does not have the. NET Framework 4.0 (perhaps the application pool has selected a lower version will also appear, untested), and the. NET Framework version is also the more important detail, you can find that when downloading Sqlite.net, the points are relatively strict, for The. Net Framework 3.5SP1 and 4.0 are separate, so you must choose a version that is consistent with the target framework version. When you are finished installing. Net 4.0, remember to switch the version of the application pool in IIS.

3. Failed to load file or assembly "System.Data.SQLite.dll" or one of its dependencies. The specified module could not be found.

The problem occurs because the Microsoft Visual C + + SP1 Redistributable Package (x64) is not installed (of course, if you are not a 64-bit system, install for x86).

4. Attempt to write a read-only database

Please check the permissions of the directory where the database resides, and join the IIS_IUSRS group with Full Control (theoretically written). On the web, it is true that adding the Users group is the correct way to add the IIS_IUSRS group, which is the group used by the IIS worker process and should be a subset of the users, so it would be safer to use IIS_IUSRS.

5. Failed to load file or assembly "System.Data.SQLite" or one of its dependencies. An attempt was made to load a program that is not properly formatted.

This question is very similar to the 3rd question, just a step further from the victory. This problem is caused by the use of the wrong version of the System.Data.SQLite.dll, that is, the use of the x86 DLL on the x64 server (and vice versa), there are 2 workarounds. The first is what I recommend, using the correct version of the DLL, and the second method is to set the "Enable 32-bit application" to true in the advanced settings of the IIS application pool. Maybe after you do that again, you're back to the third question, don't worry, x86 Visual C + + runtime is ready to load.

Note: If you choose to enable 32-bit applications, you can use only 32-bit DLLs, and one application pool cannot be mixed with 32-bit and 64-bit.

6, did not report any error, but the speed of access to SQLite is very slow, even if it is a simple select operation.

The test data is a SQLite3 database with only 2 fields and 10 data. It is clear that this is not the proper performance, after a series of tests and troubleshooting, found that the problem is caused by directory permissions. When you only make queries such as read-only operations, there is no error. Workaround refer to the 4th above.
As for the cause, see online that sqlite in the operation of the need to create temporary files, may be restricted permission after a few problems.

The above 6 questions are the problems I encountered in the deployment, step by step, and finally won the victory. More in-depth questions follow up and continue to add. Believe that many people will encounter the same problem, but also believe that this article can solve most people's problems.

I am also a new person, my career is not a programmer, if there is insufficient points, I hope the expert advice, thank you.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.