Unable to load DLL 'PortableEngine.Native.dll' or one of its dependencies: The specified module could not be found. (0x8007007E)
Question asked by ShinChulJung - 1/7/2022 at 12:58 AM

I get this error on a windows container. with .NET Core 3.1 

I use .NET Core 3.1 also I use this package
<PackageReference Include="GleamTech.DocumentUltimate" Version="5.9.7" />

and I will publish on MS Azure

Because there is the last answer in the above article,
I tried this lines adding and deleting, and I tried several times, but the error still occurs.

USER ContainerAdministrator
RUN mkdir Windows\Temp\GleamTech
RUN icacls C:\Windows\Temp\GleamTech /grant "BUILTIN\USERS:(OI)(CI)F" /t
I can't solve this error because I don't know what kind of dependency "PorableEngine.Native.dll" is causing the problem.
Actually, the DocumentUltimate itself seems to load well. (The log is well marked) But after loading it, that error message seems to appear.

Already through  DocumentUltimateConfiguration.CheckPlatformSupport method, the following result is obtained. (in windows container)
"documentViewer": true,
"portableEngine": true,
"cadEngine": false

In .NET Core 3.1 linux container, it all came out as false.

Is there no way to open DocumentUltimate with .net core 3.1 windows container?

.net framework is meaningless because the image size is too large
This is the content I wanted to dockerize with .net core.

I don't use IIS inside container.

Here is my dockerfile

FROM mcr.microsoft.com/dotnet/aspnet:3.1-nanoserver-1809



COPY . /app
ENTRYPOINT ["dotnet", "document-viewer.dll"] 
I already publish project before docker build.
when docker build,  append the build arguments options  
--build-arg CORE_ENV=Production --build-arg CORE_PORT=80

thank you!

2 Replies

Reply to Thread
Cem Alacayir Replied
Employee Post Marked As Answer
It seems the image "Windows Nano Server" you are using for docker misses some important components. Maybe you should use "Windows Server Core" image? See this article.

I found this so Nano Server seems no-go:
Nano Server does not have kernel32.dll and advapi32.dll so code that is not linked against default libs won't work. You need to either link your code against onecore.lib or install reverse forwarders. 

By the way about Azure WebApps:
Azure WebApps may have problems especially when in Free Trier.
I mean some customers in the past reported they got similar error on Azure free shared plan and it was solved when they switched to billed plan. Maybe their OS image in free plan lacks some components or native DLL search path is restricted thus the error "The specified module could not be found".

Christian Davén Replied
I have spent a few hours troubleshooting this today, and the solution seems to be to base my Docker container on "mcr.microsoft.com/dotnet/aspnet:7.0-windowsservercore-ltsc2022" (using Windows Server Core) instead of "mcr.microsoft.com/dotnet/aspnet:7.0" (using Nano Server).

Unfortunately, this makes the container image 10x as big, but at least it works.

Except that the container doesn't contain any fonts, so they will have to be installed separately...

Reply to Thread