LEADTOOLS Support
General
General Questions
FileLoadException: Could not load file or assembly 'Leadtools.DLL' or one of its dependencies. Excep
#1
Posted
:
Friday, October 14, 2016 7:32:33 AM(UTC)
Groups: Registered
Posts: 13
Hello,
We are getting this error while trying to debug an asp.net application with VS2015 and IISExpress.
We are using an x64 machine and OS.
Trying targeting both x86 and x64 getting the same error.
Usually when we are missing a c++ runtime files we copy the correct ones with correct x86 or x64 and its done.
But, i am trying to understand better the source of the problem.
I read that this error code is an error code of any uncatched exception thrown inside a native c++ code.
My question is : is this coming from your code? O/S having an issue with a dll?
I tried using ProcessMonitor to better understand but couldn't understand if i have a missing file here.
How can i pinpoint this problem?
I am attaching entire error message from the browser.
Thanks
Bye
#2
Posted
:
Friday, October 14, 2016 8:09:22 AM(UTC)
Groups: Manager, Tech Support, Administrators
Posts: 218
Was thanked: 12 time(s) in 12 post(s)
This error generally occurs when either a file or dependency is missing, or when there is an architectural issue with the project targeting the incorrect DLLs.
So the first thing to check is that the Leadtools.dll that you are trying to load in your ASP.NET application actually exists in the correct location. If it indeed does exist, then the next step is to ensure that you have the Microsoft Visual C++ 2010 Redistributable Package for both x86 and x64 installed on the machine. The Leadtools.dll requires these DLLs in order to run properly.
If all of the above exist, then you need to double check that your project CPU and .NET framework match the referenced Leadtools.dll CPU and framework.
Here is how you can check the Details of the Leadtools.dll to ensure that your using the correct DLL:
If all of the above are correct and there are no issues, then the issue may be with your IIS Express not enabling 64 bit applications.
In Visual Studio, you need to go into Tools -> Options and then under Projects and Solutions > Web Projects and ensure that 'Use the 64 bit version of IIS Express for web sites and projects' is checked:
This should help you resolve the errors that you are seeing but if it doesn't, please let me know!
Hadi Chami
Developer Support Manager
LEAD Technologies, Inc.
#3
Posted
:
Sunday, October 16, 2016 6:41:12 AM(UTC)
Groups: Registered
Posts: 13
Hello,
Here is the leadtools.dll details:
I targeted x86 specially. see :
I have put these 2 files in the same folder leadtools.dll is:
Can i use only them instead of c++ 2010 x86 install?
(I read in the leadtools help that these are needed for .net4 version of the dlls)
So, i guess i don't need the x64 iisexpress.
My questions is, can i see the problem in processmonitor somehow?
I would like to be able to identify the problem. i don't like to guess...
Thanks
Bye
#4
Posted
:
Monday, October 17, 2016 10:35:53 AM(UTC)
Groups: Manager, Tech Support, Administrators
Posts: 218
Was thanked: 12 time(s) in 12 post(s)
Thanks for your reply. You can indeed redistribute those 2 files (Msvcrp and Msvcr) with your Leadtools.dll and not have to install the 2010 VC++ runtime libraries as it is mentioned in the Files to be included information here:
https://www.leadtools.co...withyourapplication.htmlQuote:LEADTOOLS binaries for .NET 4.0 require the following Microsoft C/C++ Runtime files to be distributed in the application's PATH:
MSVCR100.dll
MSVCP100.dll
NOTE: that the filenames are the same for Win32 and x64. However, the actual binaries are different. For more information about distributing the Microsoft C/C++ runtime files, refer to:
http://msdn2.microsoft.c...s/library/ms235291.aspx. The issue in your case is that you are using IIS Express. When using IIS express, the DLLs that are used are copied to a temporary IIS Express directory such as:
C:\Users\<user_name>\AppData\Local\assembly
When this happens, it doesn't copy over all the dependencies - it only copies over the DLLs that are referenced and used by the application and not the dependencies such as the MSVCR runtime files.
To resolve this, you will either need to install the 2010 VC++ x86 runtime files, or use the full version of IIS and setup a virtual directory since in the full version of IIS the DLLs are not copied to a temp directory.
Hadi Chami
Developer Support Manager
LEAD Technologies, Inc.
#5
Posted
:
Tuesday, October 18, 2016 5:10:11 AM(UTC)
Groups: Registered
Posts: 13
Hello,
I checked my c++ redists installations:
As u can see i have c++ 2010 x86 and x64 installed.
In syswow64 i have the dlls, their version is a bit different than that of the bin folder of the lead 18.x install.
I even tried to replace them with the files from lead 18.x install (bin folder).
Did not work.
Still the same error.
I am even attaching zipped process monitor logs:
Maybe it can help.
Thank u for your help,
Bye
#6
Posted
:
Tuesday, October 25, 2016 1:12:08 PM(UTC)
Groups: Manager, Tech Support, Administrators
Posts: 218
Was thanked: 12 time(s) in 12 post(s)
Can you double check the IIS Express settings for 'Use the 64 bit version of IIS Express for web sites and projects' to make sure it is not checked, since you are using the 32 bit DLLs.
Can you also double check the Configuration Manager settings to ensure that your service project is targetting x86 and not Any CPU?
If none of these changes work, can you try deploying to IIS (non express) and checking the App pool to make sure it is enabled for 32 bit and then see if that works? Otherwise, we will need to be able to reproduce your issue on our side so sending us a small sample application might be necessary.
Thanks,
Hadi Chami
Developer Support Manager
LEAD Technologies, Inc.
#7
Posted
:
Sunday, January 15, 2017 4:02:20 AM(UTC)
Groups: Registered
Posts: 13
Hello,
Ok, i deployed to IIS and it worked.
Then i went back to VS.
Now it worked with IIS Express.
So, only god knows what happened.
Its really annoying u cannot get stack trace for the c++ exception inside the .NET / IIS Express.
Do u guys know anything about that?
In any case, this is closed for me.
Thanks for your help.
Bye
#8
Posted
:
Sunday, January 15, 2017 4:47:45 AM(UTC)
Groups: Registered
Posts: 13
Hello,
Another piece of data:
When running the VS 2015 as administrator (elevated)
The error is gone.
So something inside your c++ dlls may causing this?
Thanks
bye
#9
Posted
:
Tuesday, January 17, 2017 12:37:55 PM(UTC)
Groups: Manager, Tech Support, Administrators
Posts: 218
Was thanked: 12 time(s) in 12 post(s)
Thank you for following up this post and informing us of the resolution.
Regarding the issue you had when running as non-elevated vs. elevated: you have to run Visual studio with administrator privileges in order to deploy to IIS. This is not something inside out DLLs that causes this, this is to prevent non-authorized users from modifying things in IIS.
Hadi Chami
Developer Support Manager
LEAD Technologies, Inc.
LEADTOOLS Support
General
General Questions
FileLoadException: Could not load file or assembly 'Leadtools.DLL' or one of its dependencies. Excep
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.