title: Fail to load DLL in Windows 2008 R2 having full permissions control
body: <p>I have developed an C# application that run very well in local.</p>
  
  <p>But there is a problem when i put on the server.</p>
  
  <p>The application uses a DLL library in his references (A.dll) and in a point of the execution the A.dll creates in the Temp directory another DLL (embedded in it, let's call it B.dll). 
  But when the A.dll try to load the B.dll an exception is threw:</p>
  
  <pre><code>system.invalidoperationexception: failed to load B.dll
  </code></pre>
  
  <p>I have not access at the DLLs source, are libraries.</p>
  
  <p>So recap:</p>
  
  <ul>
  <li>The process have the full control permission on the file and path.
  (cheked)</li>
  <li>Is running like Administrator. (checked)</li>
  <li>In my application if I try to open the dll in binary mode, the
  operations have no problems.</li>
  <li>Runs well on every OS that i have tested (Windows 8_64 / XP_32 /
  2008_32 / 7_64), but fails with 2008 R2 64.</li>
  <li>I have tried to ReDownload, rename, reinstall the B.DLL, i have putted the program in the same path of the B.DLL, etc etc, with no results.</li>
  </ul>
  
  <p>So at this point I think that is a security problem on the server, like "Processes cannot load DLLs" or something similar.</p>
  
  <p>The exception:
  <a href="https://i.imgur.com/NmB2Fth.png?1" rel="nofollow noreferrer">http://i.imgur.com/NmB2Fth.png?1</a></p>
  
  <p>Anyone can suggest me any solution? Would i check better? Where?</p>
  
  <p>P.S 
  IF i try to register the dll i got the same error of this:
  <a href="https://stackoverflow.com/questions/4550229/register-dll-in-on-windows-2008-r2">Register DLL file on Windows Server 2008 R2</a></p>