2

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)

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Martin Meixger
  • 2,547
  • 24
  • 26
  • From https://stackoverflow.com/questions/52397501/nuget-references-to-assemblies-in-runtimes-folder-not-added/52461004#52461004: .NET Core and .NETSTANDARD don't copy dependencies to output directory, they are mapped using deps.json which points to relative paths from local NuGet cache. – Martin Meixger Apr 02 '19 at 14:04
  • I tryed adding `true` to the csproj but the runtimes folder wont be copied – Martin Meixger Apr 02 '19 at 14:05

0 Answers0