One of my projects we are using SkiaSharp to create and manipulate images on the server.
However when we tried to load the SkiaSharp library through our ASP.NET Core application, we got the following error message:
System.DllNotFoundException: Unable to load DLL 'libSkiaSharp' or one of its dependencies: Access is denied.
Problem is that this is a native library and the application pool user by default doesn’t have ‘Execute’ permissions to load and run this library.
Here are the steps to fix this issue:
- Go to your local nuget cache, by default %userprofile%\.nuget\packages
- Search for the SkiaSharp folder
- Right click on the folder and choose Properties from the context menu
- The Properties window is loaded. Go to the Security tab and select the application pool identity from the list of users
- Click on Edit and check the Read and Execute permission in the Allow column
- Click on OK to apply the changes.
That’s it!