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