We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

System.DllNotFoundException: Access is denied

Hello,

I’m using Aspose. Words 18.8.0 for creating pdf from doc templates. My app is written in C# and runs on. Net Core 2.1.
Everything works fine on my development PC with Windows 7 under Administrator account. Problem occurs after deployment on server.
Failing process is hosted by IIS 8 on Windows server 2012. I read your info at this page
https://docs.aspose.com/display/wordsnet/Installation#Installation-InstallingAspose.Wordsfor.NETthroughNuGet
about necessity to use Full Trust permissions, but this mechanic no longer exists in.net core. How should I set my server environment to make it work?
Thank you very much.

System.TypeInitializationException: The type initializer for ‘SkiaSharp.SKImageInfo’ threw an exception. —> System.DllNotFoundException: Unable to load DLL ‘libSkiaSharp’ or one of its dependencies: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
at SkiaSharp.SkiaApi.sk_colortype_get_default_8888()
at SkiaSharp.SKImageInfo…cctor()
— End of inner exception stack trace —
at Aspose.Words.Document.( , SaveOptions )
at Aspose.Words.Document.(Stream , String , SaveOptions )
at Aspose.Words.Document.Save(Stream stream, SaveOptions saveOptions)

@Prokop

Thanks for your inquiry. You are facing this issue because your application does not find the DLL libSkiaSharp where you are hosting it. Could you please share the steps that you are using to create and host your application at Windows Server 2012? Please also share your input Word document. We will investigate the issue on our side and provide you more information.

Thanks for your reply. Problem occurs on any Word doc containing image during rendering to Pdf (Save with PdfSaveOptions {Compliance = PdfCompliance. PdfA1b}). I can see that loading libSkiaSharp (or dependencies) is the problem, it is written in my exception, but “Access is denied” suggests that there is a problem with access rights which cause inability to load dll. And because of the note about Full Trust permissions in your documentation (link above), I expect that I need some special permissions. So my question is: How should I set user security on my configuration? Which permissions my service user needs? Which resources libSkiaSharp needs to access? Thank you

@Prokop

Thanks for your inquiry. Could you please share following detail here for our reference? We will then provide you more information about your query.

  1. Please share if you are facing this issue after installing Aspose.Words through NuGet at Windows Server 2012.
  2. Please share if you are facing this issue while publishing your application at Windows Server 2012.
  3. Could you please share the steps that you are using to reproduce this issue at our end?

Thanks for your cooperation.

  1. No, I’m installing Aspose.Words thru Nuget into VS solution on my development PC with Win7
  2. Yes
  3. Can you specify what exactly do you need? I wrote down info about system on which I’m deploying in my original question. Furthermore it is classic, VS studio 2017 => git => TFS build and deploy => Win Server 2012. It can be described in many levels of details, can you specify what details are important for you? I would expect questions like: “What is build version of your build agent?” etc.

Most important for me are these questions, could you please answer? 1) What permissions do IIS service user needs on my configuration? 2) What resources do Aspose needs to access?
Thank you

Hello, I have new finding. Aspose.Words Pdf rendering works fine with IIS app pool running under user with Administrator privileges. And it does not work with common user with minimal privileges. This is not solution because it can not be used on production environment. So I’m back to my question. Which resources/folders is Aspose using? What minimal privileges needs to be set to let it work? Thank you

@Prokop,

Thanks for your inquiry. We have logged this problem in our issue tracking system as WORDSNET-17385. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

Here was my fix

  1. I went to this folder on my development computer %userprofile%\.nuget\packages my Nuget Cache.
  2. From that root folder I went to skiasharp\1.60.1\runtimes
  3. In that folder there are various runtime folders, the one that worked for me was win7-x86
  4. In this subfolder win7-x86\native I found the libSkiaSharp.dll file.
  5. I copied that to my wwwroot folder on my web server.

Couple things about my environment

  1. Windows 2016
  2. Target Framework netcoreapp2.1
  3. Deployment Mode: Self-Contained
  4. .NET Core SDKs installed: 2.1.401
  5. .NET Core runtimes installed: Microsoft.AspNetCore.App 2.1.3

This fixed these various issues I was having

  1. Missing images on PDFs
  2. The type initializer for ‘SkiaSharp.SKImageInfo’ threw an exception.
  3. Unable to load DLL ‘libSkiaSharp’ or one of its dependencies

I also want to note that I did the suggested uninstall, remove bin folder, and reinstall from NuGet suggested in other post, that did not fix the issue.

Thank You for your post. But this does not fix “Access is denied” issue from this thread.
I’m already deploying libSkiaSharp.dll to my web server, so libSkiaSharp.dll is loaded, but some of its dependencies can not be accessed without Administrator account.

@gmboicey

Thanks for sharing the workaround of this issue.

@Prokop

We will inform you via this forum therad once there is an update available on this issue. Thanks for your patience.

I don’t think it is a dependency, it works for me now and there are no other dependencies I needed other than the missing dll. Checking the SkiaSharp project on Git only shows things for Windows 10.

Sorry it did not work, I was trying to post in one place, and a more recent place, instead of all the others post related to issues of not having libSkiaSharp.dll in the web folder. Such as missing images in PDFs, and the error of not finding libSkiaSharp library.

The only thing I can offer as suggestion would be checking security for the folder and/or the libSkiaSharp.dll file setup for both IUSR and IIS_IUSRS? I have a vague recollection of working on some versions of IIS that would need both the user and the group setup for security. Going out on a limb is the file blocked? For my setup I did not need any addition security settings, but I have windows 2016 not 2012. Another option, but I know installing software on servers is not an option sometimes, install Process Monitor to see exactly what and who is getting denied access.

@gmboicey

Thanks for sharing the detail. We will update here in this thread when there is any update available on WORDSNET-17385.

The issues you have found earlier (filed as WORDSNET-17385) have been fixed in this Aspose.Words for .NET 21.2 update and this Aspose.Words for Java 21.2 update.