title: Error when trying to load dll - An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)
body: <p>Iam using a 3rd party c++ dll in my asp.net web application.</p>
  
  <pre><code>dll - 64-bit
  asp.net Platform - Any Cpu
  asp.net Framework - 4.0 (vs 2010)
  System Os - Win 7 Professional (64-bit)
  </code></pre>
  
  <p>I have placed the dll in the Applications folder and called the dll with its full path as:</p>
  
  <pre><code>[DllImport(@"D:\Application\Sampledll.dll",
              EntryPoint = "SampleFunc",
              CharSet = CharSet.Ansi,
              CallingConvention = CallingConvention.StdCall)]
      public static extern int SampleFunc(char[] ch1, char[] ch2);
  </code></pre>
  
  <p>But I got the below result:</p>
  
  <pre><code>An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)
  </code></pre>
  
  <p>When searched with the Error code: 0x8007000B - It meant 'Using 32-bit dll on 64-bit system'</p>
  
  <p>But the dll is 64-bit dll....</p>
  
  <p>Any how I tried the solution of this error by changing the Target Platform of VS to 'x86' &amp; 'x64' and setting 'Enable 32-Bit Application' property of IIS to 'True'</p>
  
  <p>But got the same error.........</p>
  
  <p>Can any one help to get around this problem.... </p>