title: Unmanaged DLLs fail to load on ASP.NET server
body: <p>This question relates to an ASP.NET website, originally developed in VS 2005 and now in VS 2008.</p>
  
  <p>This website uses two unmanaged external DLLs which are not .NET and I do not have the source code to compile them and have to use them as is.</p>
  
  <p>This website runs fine from within Visual Studio, locating and accessing these external DLLs correctly. However, when the website is published on a webserver (runnning IIS6 and ASP.NET 2.0) rather than the development PC it cannot locate and access these external DLLs, and I get the following error:</p>
  
  <p><code>Unable to load DLL 'XYZ.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)</code></p>
  
  <p>The external DLLs are located in the bin directory of the website, along with the managed DLLs that wrap them and all the other DLLs for the website.</p>
  
  <p>Searching this problem reveals that many other people seem to have the same problem accessing external non.NET DLLs from ASP.NET websites, but I haven't found a solution that works.</p>
  
  <p>I have tried the following:</p>
  
  <ul>
  <li>Running DEPENDS to check the dependencies to establish that the first three
  are in System32 directory in the path, the last is in the .NET 2
  framework.</li>
  <li>I put the two DLLs and their dependencies in
  System32 and rebooted the server, but website still
  couldn't load these external DLLs.</li>
  <li>Gave full rights to ASPNET, IIS_WPG and IUSR (for that server) to
  the website bin directory and rebooted, but website still couldn't
  load these external DLLs.</li>
  <li>Added the external DLLs as existing items to the projects and set
  their "Copy to Output" property to "Copy Always", and website
  still can't find the DLLs.</li>
  <li>Also set their "Build Action" property to "Embedded resource" and
  website still can't find the DLLs.</li>
  </ul>
  
  <p>Any assistance with this problem would be greatly appreciated!</p>