imazen/imageflow-dotnet

Imageflow Module not found when deployed to a production server

thecaptncode opened this issue · 14 comments

We are starting to use Imageflow.net within an ASP.net application. Imageflow is set up and working fine with our development and test servers, but when deployed to our production servers, which are very similarly configured VMs, we started receiving the following error.

Looking for "imageflow.dll" Subdir="x64", IsUnix=False, IsDotNetCore=False Before searching: Unable to load DLL 'imageflow': The specified module could not be found. (Exception from HRESULT: 0x8007007E) File not found: C:\Websites\demo\x64\imageflow.dll
File not found: C:\Websites\demo\imageflow.dll
File not found: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\demo\07ba4e9d\500187f\assembly\dl3\ab715b07\00118335_6882d601\x64\imageflow.dll
File not found: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\demo\07ba4e9d\500187f\assembly\dl3\ab715b07\00118335_6882d601\imageflow.dll
File not found: C:\Websites\demo\runtimes\win-x64\native\x64\imageflow.dll
File not found: C:\Websites\demo\runtimes\win-x64\native\imageflow.dll
File not found: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\demo\07ba4e9d\500187f\assembly\dl3\ab715b07\00118335_6882d601\runtimes\win-x64\native\x64\imageflow.dll
File not found: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\demo\07ba4e9d\500187f\assembly\dl3\ab715b07\00118335_6882d601\runtimes\win-x64\native\imageflow.dll
   at Imageflow.Bindings.NativeMethods.imageflow_context_create(UInt32 imageflow_abi_ver_major, UInt32 imageflow_abi_ver_minor)
   at Imageflow.Bindings.NativeLibraryLoader.FixDllNotFoundException[T](String basename, Func`1 invokingOperation, IEnumerable`1 customSearchDirectories)

Stack Trace:    at Imageflow.Bindings.LoadLogger.RaiseException()
   at Imageflow.Bindings.NativeLibraryLoader.FixDllNotFoundException[T](String basename, Func`1 invokingOperation, IEnumerable`1 customSearchDirectories)
   at Imageflow.Bindings.JobContextHandle..ctor()
   at Imageflow.Bindings.JobContext..ctor()
   at Imageflow.Fluent.ImageJob.<GetImageInfo>d__50.MoveNext()

C:\Websites\demo is the application root and the 64 bit runtime is in the C:\Websites\demo\bin folder. I have verified that the Application Pools are 64 bit only on all servers.

Reading your reply made me realize I misspoke an important detail. This is a Web Site Project and not a Web Application. My understanding is they are always targeted to "Any CPU" but you control 64 vs 32 bit by the application pool. The application pool on the Dev and Test servers as well as the production servers are set to not allow 32 bit.

Also, I am running 0.7.2 of imageflow.net and ImageFlow.NativeRuntime.win-x86_64 1.4.10-rc50

The path is C:\Websites\demo\bin\imageflow.dll and the application root is C:\Websites\demo\

Okay. I think I've added support for Web Site projects in https://github.com/imazen/imageflow-dotnet/releases/tag/v0.7.4

Can you report back and let me know how it goes? I tried setting up a web site project but the Imageflow.NativeRuntime.* packages aren't even able to copy imageflow.dll into the /bin folder. Did you copy it manually?

Yes, I had to copy the imageflow.dll manually. It did not copy automatically.

I tried the updated DLL and it did not work. Here is the error I received.

Looking for "imageflow.dll" RID="win-x64", IsUnix=False, IsDotNetCore=False RelativeSearchPath="C:\Websites\demo\bin"
Before searching: Unable to load DLL 'imageflow': The specified module could not be found. (Exception from HRESULT: 0x8007007E) File not found: C:\Websites\demo\bin\x64\imageflow.dll
Error The specified module could not be found loading imageflow from C:\Websites\demo\bin\imageflow.dll
File not found: C:\Websites\demo\bin\runtimes\win-x64\native\imageflow.dll
File not found: C:\Websites\demo\x64\imageflow.dll
File not found: C:\Websites\demo\imageflow.dll
File not found: C:\Websites\demo\runtimes\win-x64\native\imageflow.dll
File not found: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\demo\07ba4e9d\500187f\assembly\dl3\ab715b07\00a3d764_0890d601\x64\imageflow.dll
File not found: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\demo\07ba4e9d\500187f\assembly\dl3\ab715b07\00a3d764_0890d601\imageflow.dll
File not found: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\demo\07ba4e9d\500187f\assembly\dl3\ab715b07\00a3d764_0890d601\runtimes\win-x64\native\imageflow.dll
   at Imageflow.Bindings.NativeMethods.imageflow_context_create(UInt32 imageflow_abi_ver_major, UInt32 imageflow_abi_ver_minor)
   at Imageflow.Bindings.NativeLibraryLoader.FixDllNotFoundException[T](String basename, Func`1 invokingOperation, IEnumerable`1 customSearchDirectories)

Stack Trace:    at Imageflow.Bindings.LoadLogger.RaiseException()
   at Imageflow.Bindings.NativeLibraryLoader.FixDllNotFoundException[T](String basename, Func`1 invokingOperation, IEnumerable`1 customSearchDirectories)
   at Imageflow.Bindings.JobContextHandle..ctor()
   at Imageflow.Bindings.JobContext..ctor()
   at Imageflow.Fluent.ImageJob.<GetImageInfo>d__50.MoveNext()

Thank you for looking into this so quickly yesterday.

I verified that both dlls are in the ~/bin folder:

07/05/2020  03:32 PM         4,944,384 imageflow.dll
09/21/2020  07:14 AM           173,056 Imageflow.Net.dll

Or, a fourth reason - you don't have the C Runtime installed.

Please take this step separately so we know what resolved the problem.
https://aka.ms/vs/16/release/vc_redist.x64.exe

Yes! That solved the problem. I did not realize that was prerequisite.
Thanks so much for your help. I really appreciate it.

The C Runtime is generally installed on Windows by default. What version of Windows were you running? Any idea why the Universal CRT was missing?

Production is running a decade old OS Windows Web Server 2008 R2. We have plans to upgrade soon. I spoke to ops and they did not know why it was missing. Was it automatically installed back then?

I don't think it auto-installs on WS2008R2, no.