title: Microsoft.Web.Administration assembly error on azure
body: <p>I have been trying to deploy a new asp.net mvc project to Azure for production. Everything works locally but I'm having troubles with assemblies when deploying. </p>
  
  <p>Upon navigating to most pages, I started receiving an error of:</p>
  
  <pre><code>Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
  </code></pre>
  
  <p>Using the information from : <a href="https://stackoverflow.com/a/8824250/1411764">https://stackoverflow.com/a/8824250/1411764</a> I caught the exception:</p>
  
  <pre><code>Could not load file or assembly 'Microsoft.Web.Administration, 
  Version=7.9.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or 
  one of its dependencies. The system cannot find the file specified.
  </code></pre>
  
  <p><code>Microsoft.Web.Administration</code> appears to be an IIS assembly.</p>
  
  <p>I then added <code>Microsoft.Web.Administration</code> to the project using <a href="https://www.nuget.org/packages/Microsoft.Web.Administration" rel="nofollow noreferrer" title="nuget">Nuget</a>.</p>
  
  <p>Now I'm stuck with a new error:</p>
  
  <pre><code>Could not load file or assembly 'Microsoft.Web.Administration' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
  </code></pre>
  
  <p>I have tried adding a binding redirect into web.config</p>
  
  <pre><code>&lt;dependentAssembly&gt;
     &lt;assemblyIdentity name="Microsoft.Web.Administration" publicKeyToken="31BF3856AD364E35" culture="neutral" /&gt;
     &lt;bindingRedirect oldVersion="0.0.0.0-7.9.0.0" newVersion="7.9.0.0" /&gt;
  </code></pre>
  
  <p></p>
  
  <p>At this point it breaks straight away and I can't load any page. (Seems worse than when I didn't have the extra dll.</p>
  
  <p>I've read many similar posts but can't seem to figure it out. Hopefully I'm doing something simple wrong from a lack of understanding regarding Azure. Any help would be much appreciated.</p>
  
  <p><strong>Updated Info</strong></p>
  
  <p>Right clicking properties for reference <code>Microsoft.Web.Administration</code>:</p>
  
  <p>Copy Local: True</p>
  
  <p>Runtime Version v2.0.50727</p>
  
  <p>Version: 7.0.0.0</p>
  
  <p>Calling assembly : Microsoft.WebMatrix.Core, Version=8.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35</p>
  
  <p><strong>Update 2 - from comments:</strong></p>
  
  <p>After settings binding to <code>7.0.0.0</code> it now compiles again on the server and can display some pages but I'm still catching the previous error.</p>
  
  <pre><code>Could not load file or assembly 'Microsoft.Web.Administration, Version=7.9.0.0, 
  Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. 
  The located assembly's manifest definition does not match the assembly reference. 
  (Exception from HRESULT: 0x80131040)
  </code></pre>
  
  <p>I assume from this that Nuget has only supplied version <code>7.0.0.0</code> however something thinks it needs <code>7.9.0.0</code>.</p>
  
  <p><strong>Update 3: Success</strong></p>
  
  <p>I started looking into the version number differences and found this <a href="https://stackoverflow.com/a/11216326/1411764">stack question</a> which explains some differences between IIS and IISExpress.</p>
  
  <p>For now I changed the redirect from <code>7.9.0.0</code> to <code>7.0.0.0</code> which seems to of solved the issue.</p>
  
  <pre><code>&lt;bindingRedirect oldVersion="0.0.0.0-7.9.0.0" newVersion="7.0.0.0" /&gt;
  </code></pre>
  
  <p>The assemblies now work and the pages are all loading.</p>
  
  <p>This solution feels very hacky though. Is binding to a lower version bad practice or likely to cause issues in the future? I'm worried that I should be addressing the code calling the different IIS versions.</p>