Home Could not load file or assembly 'EX.DLL' or one of its dependencies in WCF App but not in Console App
Reply: 0

Could not load file or assembly 'EX.DLL' or one of its dependencies in WCF App but not in Console App

user54255
1#
user54255 Published in September 21, 2018, 2:42 am

I am creating a WCF Application that works with an SDK that I was given. For testing purposes I created a console application to work with the SDK. After I had confirmed that my code worked with the SDK properly, I replicated the functionality with the WCF Application. When I invoke the application with a SOAP client I get the following error thrown as an exception when I invoke code from the SDK.

Could not load file or assembly 'EX.DLL' or one of its dependencies. The specified module could not be found.

All other endpoints are still fully functional and code paths that avoid the SDK do not fail. Both projects are using .NET 4.7.

My first thought was that it had to do with the copy local or output directory of one of the files. I tried changing copy local to true. This caused the same error to appear in the browser when navigating the localhost page and does prevent the other endpoints from working.

The only DLL I am referencing for this is 'EM.DLL'. They are located in the same file folder so I doubted that the application couldn't find that one. Instead I started looking for something that could be its dependency. There are 76 other DLLs in the SDK folder so trial and error wasn't really an option. Instead I tried to figure out what the dependency could be by using Dependency Walker but I'm not familiar enough with the program to understand what's going on when I open the DLL and the answer is not readily apparent.

Does WCF handle DLL loading differently than a console app? How can I find which DLL is failing to load?

Edit: I've now tried changing the architecture, telling iss to probe the dlls filepath, adding the dlls to the GAC instead and various combinations of adding the dlls to the references with all combinations of copy local all while looking through the Fusion Logs. Some combinations allow me to get the error through the soap call while others fail on startup with seeming random preference. Often times it does find the EX.DLL but it must be one of its dependencies that it can't find and the logs do not tell me what the dependencies are.

Edit 2: Here is the Fusion Log Viewer for those asking. fuslogvw.exe

And here is the output of the EX log when EM's copy local is set to false in the project references. If I set it to true, this log changes to a success where it found the dll the temp files of the program but then it fails on startup with the same error message. This way, the log is only generated when I try to call the specific code in that dll.

*** Assembly Binder Log Entry  (1/15/2018 @ 9:58:23 AM) ***

The operation failed.
Bind result: hr = 0x80070002. The system cannot find the file specified.

Assembly manager loaded from:  C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
Running under executable  C:\Program Files (x86)\IIS Express\iisexpress.exe
--- A detailed error log follows. 

=== Pre-bind state information ===
LOG: DisplayName = EX, Version=9.7.2079.1117, Culture=neutral, PublicKeyToken=0ca8877e5830dba7
 (Fully-specified)
LOG: Appbase = file:///C:/Users/username/Source/Repos/solutionpath/ProjectName/
LOG: Initial PrivatePath = C:\Users\username\Source\Repos\solutionpath\ProjectName\bin
LOG: Dynamic Base = C:\Users\username\AppData\Local\Temp\Temporary ASP.NET Files\vs\e167a27b
LOG: Cache Base = C:\Users\username\AppData\Local\Temp\Temporary ASP.NET Files\vs\e167a27b
LOG: AppName = 8d6fbe3b
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Users\username\Source\Repos\solutionpath\ProjectName\web.config
LOG: Using host configuration file: C:\Users\username\Documents\IISExpress\config\aspnet.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: GAC Lookup was unsuccessful.
LOG: Attempting download of new URL file:///C:/Users/username/AppData/Local/Temp/Temporary ASP.NET Files/vs/e167a27b/8d6fbe3b/EX.DLL.
LOG: Attempting download of new URL file:///C:/Users/username/AppData/Local/Temp/Temporary ASP.NET Files/vs/e167a27b/8d6fbe3b/EX/EX.DLL.
LOG: Attempting download of new URL file:///C:/Users/username/Source/Repos/solutionpath/ProjectName/bin/EX.DLL.
LOG: Attempting download of new URL file:///C:/Users/username/Source/Repos/solutionpath/ProjectName/bin/EX/EX.DLL.
LOG: Attempting download of new URL file:///C:/Users/username/AppData/Local/Temp/Temporary ASP.NET Files/vs/e167a27b/8d6fbe3b/EX.EXE.
LOG: Attempting download of new URL file:///C:/Users/username/AppData/Local/Temp/Temporary ASP.NET Files/vs/e167a27b/8d6fbe3b/EX/EX.EXE.
LOG: Attempting download of new URL file:///C:/Users/username/Source/Repos/solutionpath/ProjectName/bin/EX.EXE.
LOG: Attempting download of new URL file:///C:/Users/username/Source/Repos/solutionpath/ProjectName/bin/EX/EX.EXE.
LOG: All probing URLs attempted and failed.

*** Assembly Binder Log Entry  (1/15/2018 @ 9:58:23 AM) ***

The operation failed.
Bind result: hr = 0x80070002. The system cannot find the file specified.

Assembly manager loaded from:  C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
Running under executable  C:\Program Files (x86)\IIS Express\iisexpress.exe
--- A detailed error log follows. 

=== Pre-bind state information ===
LOG: DisplayName = EX, Version=9.7.2079.1117, Culture=neutral, PublicKeyToken=0ca8877e5830dba7
 (Fully-specified)
LOG: Appbase = file:///C:/Users/username/Source/Repos/solutionpath/ProjectName/
LOG: Initial PrivatePath = C:\Users\username\Source\Repos\solutionpath\ProjectName\bin
LOG: Dynamic Base = C:\Users\username\AppData\Local\Temp\Temporary ASP.NET Files\vs\e167a27b
LOG: Cache Base = C:\Users\username\AppData\Local\Temp\Temporary ASP.NET Files\vs\e167a27b
LOG: AppName = 8d6fbe3b
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Users\username\Source\Repos\solutionpath\ProjectName\web.config
LOG: Using host configuration file: C:\Users\username\Documents\IISExpress\config\aspnet.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: GAC Lookup was unsuccessful.
LOG: Attempting download of new URL file:///C:/Users/username/AppData/Local/Temp/Temporary ASP.NET Files/vs/e167a27b/8d6fbe3b/EX.DLL.
LOG: Attempting download of new URL file:///C:/Users/username/AppData/Local/Temp/Temporary ASP.NET Files/vs/e167a27b/8d6fbe3b/EX/EX.DLL.
LOG: Attempting download of new URL file:///C:/Users/username/Source/Repos/solutionpath/ProjectName/bin/EX.DLL.
LOG: Attempting download of new URL file:///C:/Users/username/Source/Repos/solutionpath/ProjectName/bin/EX/EX.DLL.
LOG: Attempting download of new URL file:///C:/Users/username/AppData/Local/Temp/Temporary ASP.NET Files/vs/e167a27b/8d6fbe3b/EX.EXE.
LOG: Attempting download of new URL file:///C:/Users/username/AppData/Local/Temp/Temporary ASP.NET Files/vs/e167a27b/8d6fbe3b/EX/EX.EXE.
LOG: Attempting download of new URL file:///C:/Users/username/Source/Repos/solutionpath/ProjectName/bin/EX.EXE.
LOG: Attempting download of new URL file:///C:/Users/username/Source/Repos/solutionpath/ProjectName/bin/EX/EX.EXE.
LOG: All probing URLs attempted and failed.

*** Assembly Binder Log Entry  (1/15/2018 @ 9:58:23 AM) ***

The operation failed.
Bind result: hr = 0x80070002. The system cannot find the file specified.

Assembly manager loaded from:  C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
Running under executable  C:\Program Files (x86)\IIS Express\iisexpress.exe
--- A detailed error log follows. 

=== Pre-bind state information ===
LOG: DisplayName = EX, Version=9.7.2079.1117, Culture=neutral, PublicKeyToken=0ca8877e5830dba7
 (Fully-specified)
LOG: Appbase = file:///C:/Users/username/Source/Repos/solutionpath/ProjectName/
LOG: Initial PrivatePath = C:\Users\username\Source\Repos\solutionpath\ProjectName\bin
LOG: Dynamic Base = C:\Users\username\AppData\Local\Temp\Temporary ASP.NET Files\vs\e167a27b
LOG: Cache Base = C:\Users\username\AppData\Local\Temp\Temporary ASP.NET Files\vs\e167a27b
LOG: AppName = 8d6fbe3b
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Users\username\Source\Repos\solutionpath\ProjectName\web.config
LOG: Using host configuration file: C:\Users\username\Documents\IISExpress\config\aspnet.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: The same bind was seen before, and was failed with hr = 0x80070002.
ERR: Unrecoverable error occurred during pre-download check (hr = 0x80070002).

*** Assembly Binder Log Entry  (1/15/2018 @ 9:58:23 AM) ***

The operation failed.
Bind result: hr = 0x80070002. The system cannot find the file specified.

Assembly manager loaded from:  C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
Running under executable  C:\Program Files (x86)\IIS Express\iisexpress.exe
--- A detailed error log follows. 

=== Pre-bind state information ===
LOG: DisplayName = EX, Version=9.7.2079.1117, Culture=neutral, PublicKeyToken=0ca8877e5830dba7
 (Fully-specified)
LOG: Appbase = file:///C:/Users/username/Source/Repos/solutionpath/ProjectName/
LOG: Initial PrivatePath = C:\Users\username\Source\Repos\solutionpath\ProjectName\bin
LOG: Dynamic Base = C:\Users\username\AppData\Local\Temp\Temporary ASP.NET Files\vs\e167a27b
LOG: Cache Base = C:\Users\username\AppData\Local\Temp\Temporary ASP.NET Files\vs\e167a27b
LOG: AppName = 8d6fbe3b
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Users\username\Source\Repos\solutionpath\ProjectName\web.config
LOG: Using host configuration file: C:\Users\username\Documents\IISExpress\config\aspnet.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: The same bind was seen before, and was failed with hr = 0x80070002.
ERR: Unrecoverable error occurred during pre-download check (hr = 0x80070002).

One of the strange things about the EM log is that it seems to find it in the GAC. I did not add it to the GAC and if I try to remove it BOTH the WCF application and the Console application encounter exceptions at startup. I thought the reference was supposed to tell it the path to the file.

share|improve this question
  • Nothing is different. You're probably having an issue with binding redirects. Turn on fusion logging (do a search, you'll find instructions). Reboot and re-test. You can check the logs to see where the application is looking, what it finds or does not find, and why it fails to load. – Will Jan 12 at 21:38
  • Thanks for the suggestion. I've been looking through the logs, including one called EX.HTM but it says that the assembly was bound successfully yet I get the same error. I tried to use grep to find relevant errors and couldn't find any. – Squar3R007 Jan 12 at 22:15
  • I don't think you're reading the logs. Can you show a screenshot of fuslogvw.exe? – Will Jan 13 at 17:52

active oldest votes

Your Answer

StackExchange.ifUsing("editor", function () { StackExchange.using("externalEditor", function () { StackExchange.using("snippets", function () { StackExchange.snippets.init(); }); }); }, "code-snippets"); StackExchange.ready(function() { var channelOptions = { tags: "".split(" "), id: "1" }; initTagRenderer("".split(" "), "".split(" "), channelOptions); StackExchange.using("externalEditor", function() { // Have to fire editor after snippets, if snippets enabled if (StackExchange.settings.snippets.snippetsEnabled) { StackExchange.using("snippets", function() { createEditor(); }); } else { createEditor(); } }); function createEditor() { StackExchange.prepareEditor({ heartbeatType: 'answer', convertImagesToLinks: true, noModals: false, showLowRepImageUploadWarning: true, reputationToPostImages: 10, bindNavPrevention: true, postfix: "", onDemand: true, discardSelector: ".discard-answer" ,immediatelyShowMarkdownHelp:true }); } });
 
StackExchange.ready( function () { StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f48234338%2fcould-not-load-file-or-assembly-ex-dll-or-one-of-its-dependencies-in-wcf-app-b%23new-answer', 'question_page'); } );

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged c# .net wcf dll or ask your own question.

StackExchange.ready(function(){$.get('/posts/48234338/ivc/aa25');});
StackExchange.ready(function () { StackExchange.responsiveness.addSwitcher(); }) (function(i, s, o, g, r, a, m) { i['GoogleAnalyticsObject'] = r; i[r] = i[r] || function() { (i[r].q = i[r].q || []).push(arguments) }, i[r].l = 1 * new Date(); a = s.createElement(o), m = s.getElementsByTagName(o)[0]; a.async = 1; a.src = g; m.parentNode.insertBefore(a, m); })(window, document, 'script', 'https://www.google-analytics.com/analytics.js', 'ga'); StackExchange.ready(function () { StackExchange.ga.init({ sendTitles: true, tracker: window.ga, trackingCodes: [ 'UA-108242619-1' ] }); StackExchange.ga.setDimension('dimension2', '|c#|.net|wcf|dll|'); StackExchange.ga.setDimension('dimension3', 'Questions/Show'); StackExchange.ga.trackPageView(); }); /**/ var _qevents = _qevents || [], _comscore = _comscore || []; (function() { var ssl = 'https:' == document.location.protocol, s = document.getElementsByTagName('script')[0], qc = document.createElement('script'); qc.async = true; qc.src = (ssl ? 'https://secure' : 'http://edge') + '.quantserve.com/quant.js'; s.parentNode.insertBefore(qc, s); _qevents.push({ qacct: "p-c1rF4kxgLUzNc" }); /**/ var sc = document.createElement('script'); sc.async = true; sc.src = (ssl ? 'https://sb' : 'http://b') + '.scorecardresearch.com/beacon.js'; s.parentNode.insertBefore(sc, s); _comscore.push({ c1: "2", c2: "17440561" }); })();
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.49 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO