问题
The ASP.NET Core 2.2 project references Microsoft.EntityFrameworkCore.Sqlite (2.2.3)
as a PackageReference
.
Debugging the app in IIS Express works fine, because of the elevated user process.
Problem: Debugging the app in IIS throws an error
Unable to load DLL 'e_sqlite3' or one of its dependencies: Access is denied
How can I debug the app in IIS without laborious publishing steps?
My analysis so far: while e_sqlite3.dll
is found and loaded successfully in the folder %userprofile%\.nuget\packages\sqlitepclraw.lib.e_sqlite3.v110_xp\1.1.12\runtimes\win-x64\native\e_sqlite3.dll
it has only Read
but no Read & Execute
permission set.
The missing Execute
permissions seems to be the culprit.
It works if I give Users
group or ApplicationPoolIdentity
also Read & Execute
.
Why is the global NuGet packages folder missing Read & Execute
? Is this only a problem of the unmanaged code dll's?
Stack Trace
System.DllNotFoundException: Unable to load DLL 'e_sqlite3' or one of its dependencies: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
at SQLitePCL.SQLite3Provider_e_sqlite3.NativeMethods.sqlite3_libversion_number()
at SQLitePCL.SQLite3Provider_e_sqlite3.SQLitePCL.ISQLite3Provider.sqlite3_libversion_number()
at SQLitePCL.raw.SetProvider(ISQLite3Provider imp)
来源:https://stackoverflow.com/questions/55472113/access-is-denied-debugging-asp-net-core-app-referencing-sqlite-running-in-iis