title: Can't access to iis remote server programatically with c#
body: <p>I need to access to a distant iis on a remote machine, It actually work fine when I tried to access to it giving an ip+port to my local machine in the browser and iis seems work fine and I can control it with the iis Manager interface.</p>
  
  <p><a href="https://i.stack.imgur.com/mcqUw.jpg" rel="nofollow noreferrer">iis remotely access from my local machine</a></p>
  
  <p><a href="https://i.stack.imgur.com/51yui.jpg" rel="nofollow noreferrer">Ican access to the distant web site</a></p>
  
  <p>My problem is when I need to use this code (I've already test it and it works perfectly as a localhost) my code threw me this exception :</p>
  
  <pre><code>System.UnauthorizedAccessException: 'Retrieving the COM class factory for remote component with CLSID {2B72133B-3F5B-4602-8952-803546CE3344} from machine RD01 failed due to the following error: 80070005 RD01.'
  </code></pre>
  
  <p>When I try to debug what the ServerManager return it show me this:</p>
  
  <pre><code>'serverManager.ApplicationDefaults' threw an exception of type 'System.UnauthorizedAccessException'
  </code></pre>
  
  <p>Note: I've already tried this solution mentioned in the following link, but it does not work </p>
  
  <p><a href="https://stackoverflow.com/questions/22458410/credentials-for-servermanager-openremote">Credentials for ServerManager.OpenRemote</a></p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>I forgot to mention that I work with Microsoft.Web.Administration.dll v 7.0.0
  and my application is a desktop app with WPF</p>