I am getting this exception
DllNotFoundException: Unable to load DLL 'e_sqlite3': The specified module could not be found. (Exception from HRESULT: 0x8007007E
on this line:
SQLiteConnection connection = new SQLiteConnection(App.databasePath)
So, I have simple CRUD app with local database. Everything work on Debug and Even release build mode with AnyCPU, x86 and x64 but this problem starts when I make installer with Visual studio installer. I make it by adding project output files (primary output) + app icon and empty database file.
And after I install it with setup I get that error. As I said, in visual studio it is working fine.
EDIT: It's seems that I am on my way to solution. Now I see that in debug build I have 2 folders x86 and x64 with that file and in install folder I don't have rights to make folders and files? How can I fix it?
You need to set project build to either x86
or x64
for SQLite3
. The x86 route will more compatibility , so use that option unless your doing some specific 64-bit stuff.
also make sure you set the copy to output for SQLite3 to Copy Always in the properties tool window.
and also ensure that your project is set to the x86 option as mentioned above.
First some background....
Unlike conventional DLLs, .NET DLLs don't actually contain the code that gets run on the target machine. The AnyCPU/x86/x64 flag indicates which platforms the DLL supports, but the instructions themselves are Common Intermediate Language bytecode. It's up to the .NET JIT compiler to load the DLL at runtime and generate the actual assembly instructions based on whether the application is running in 32 or 64 bit mode.
So back to your problem. The fact that you've got both x86 and x64 DLLs suggests to me you're using a version of SQLite where they've provided separate DLLs with the 32 and 64 bit flags set differently. If your application is targeting one or the other then all you need to do is add the appropriate version to your project and in the file properties set "Build Action" to "None" and set "Copy to Output Directory" to "Copy if newer".
If your project is being built with AnyCPU then you're going to have to add both files to your project, using different subfolders if they have the same name. Then, before you do any SQLite operations you're going to have to determine at runtime whether your app is running 32 or 64 bit mode and manually load the appropriate DLL. This article shows some code that will do this, it simply looks at the value of IntPtr.Size
to determine the mode and calls Assembly.LoadFrom()
to do the load. Once loaded, all the other SQLite commands will run fine.
The best, and simplest, solution however is to just use a version of SQL that has the flag set for both 32 and 64 bit. For that you'll need to go have a look back on the SQLite download page, or just add it to your project automatically via NuGet by right-clicking on yoru project, selecting "Manage NuGet Packages", click "Browse" and select the "System.Data.SQLite" project.
ch Notes Chilkat Software Tech Notes
HTTP “broken pipe” Error on non-Windows Systems (Linux, iOS, MacOSX, etc.)
HomeUncategorizedHTTP “broken pipe” Error on non-Windows Systems (Linux, iOS, MacOSX, etc.)
September 6, 2019
HTTP “broken pipe” Error on non-Windows Systems (Linux, iOS, MacOSX, etc.)
If you see the error lines “The connection already exists, as far as we know..” followed by “socketError: Broken pipe” in any LastErrorText for a method that sends an HTTP request, it means the following: The server replied to the previous request without a “Connection: close” header, thus allowing the client to keep the connection open for the next request. However, when the client (Chilkat) sent the next request, the connection was actually closed (thus the “broken pipe”).
Solution: This problem should be fixed in Chilkat v9.5.0.79 and above. Chilkat will automatically (internally) reconnect to the server and then send the request.
FullRequestBd:
DllDate: Mar 13 2019
ChilkatVersion: 9.5.0.77
UnlockPrefix:
Architecture: Little Endian; 64-bit
Language: Cocoa Objective-C
VerboseLogging: 0
uriPath: ***
fullRequestBody:
autoReconnect: 1
Sending request with body...
sendReqBody:
sendReqHeader:
omitContentType: 0
sendReqHeader2:
checkEstablishConnection:
The connection already exists, as far as we know..
--checkEstablishConnection
addAuthAws:
AwsSignatureVersion: 4
buildAwsCanonicalQueryParams:
queryParams:
canonicalizedQueryParams:
--buildAwsCanonicalQueryParams
awsAuthHeaderV4:
finalSignature: ***
authHeaderValue: AWS4-HMAC-SHA256 Credential=xxx/yyy6/eu-west-3/s3/aws4_request,SignedHeaders=host;x-amz-content-sha256;x-amz-date,Signature=***
--awsAuthHeaderV4
--addAuthAws
--sendReqHeader2
--sendReqHeader
Error sending on socket (1)
socketErrno: 32
socketError: Broken pipe
send_size: 16413
Failed to send TLS message.
--sendReqBody
--fullRequestBody
Failed.
--FullRequestBd
User contributions licensed under CC BY-SA 3.0