System.DllNotFoundException: Unable to load DLL: The specified module could not be found. (Exception from HRESULT: 0x8007007E)

-4

I have the same .net solution in two different folders and one works and another doesn't.

The first that works it's in my computer in "\Desktop\ICN" and the other it's on a server "\nameOfServer...\ICN". When I run the first and call a web service with a [WebMethod] that uses ML.NET and I do all the machine learning computation that I need, it works.

As for the second folder (second project), when I tried to debug using visual studio (the project it's on the server and I debug in my computer) gives me this error.

https://imgur.com/a/SMBmPPW (first image)

My computer runs windows 10 (64 bits) and the server windows server 2012 R2 (64 bits).

My projects it's on "Any CPU" when I debug and with the project, ASP.NET Web Application (.NET Framework), "RS_WebApp" on 64 bits that ML.NET requires and the other 2 projects on "Any CPU".

https://imgur.com/a/SMBmPPW (second image)

I am using the "mlContext.Recommendation().Trainers.MatrixFactorization(options)" and when I build the application it generates the "MatrixFactorizationNative.dll" on "\ICN\RS_WebApp\bin".

The only way that I put to work fine, when debug, was putting this dll on the "C:\Windows\SysWOW64" (in my computer) (ML.NET requires 64 bits) but the problem is that it doesn't work when it's the server calling that method because it doesn't have that file in its folder "C:\Windows\SysWOW64" (or similar to that in windows server) and I can't put that file in the server.

I already tried to put the dll on the project with "Copy to Output Directory: Copy if newer" and it didn't work.

https://imgur.com/a/SMBmPPW (third image)

I also put manually the dll on "\ICN\RS_WebApp\bin\x64" and it didn't work.

I also tried to "Add Reference" on the project (that have the web service with the web method that calls ML.NET "RS_WebApp") the dll but this error happen.

https://imgur.com/a/SMBmPPW (fourth image)

I don't know what folder I can put the dll on, to correctly load that dll.

My thoughts on this are the following:
- something related with debugging a solution with 1 project 64 bits and 2 projects 32 bits, and it "misses" where was the dll for the 64 bits project.
- ML.NET (web API) can have some problem with files in a computer and running on other.

Edit:

https://file.io/xDGqRG

Here, It goes the ".csproj" of the project that have that issue. I already read like over 50 stackoverflow and github discussions, and I can't find a solution to this problem. I will be much appreciated if someone can help with this pls.

c#
.net
dll
ml.net
asked on Stack Overflow Jun 18, 2019 by Pedro Vieira • edited Jul 5, 2019 by Pedro Vieira

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0