Access is denied debugging ASP.NET Core app referencing Sqlite running in IIS

旧城冷巷雨未停 提交于 2019-12-11 00:12:52

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!