title: WCF gets Access denied when the consumer try invoke a WCF service calls hosted on Virtual Machine
body: <p><strong>Problem</strong><br></p>
  
  <pre><code>System.ServiceModel.Security.SecurityAccessDeniedException : Access is denied.
  </code></pre>
  
  <p><strong>Relevant Stack lines (reduced)</strong><br></p>
  
  <pre><code>Server stack trace: 
  at System.ServiceModel.Channels.ServiceChannel.ThrowIfFaultUnderstood(Message reply, MessageFault fault, String action, MessageVersion version, FaultConverter faultConverter)
  
  Exception rethrown at [0]:
  at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
  </code></pre>
  
  <p><strong>Environment</strong><br>
  Developer Machine (host): Windows Vista, Visual Studio 2008, nUnit<br>
  Test Machine (guest): Windows 2003, IIS, Windows 2003 Firewall (disabled)<br>
  Virtual Machine: Virtual PC<br>
  Network: Microsoft Loopback Adapter<br></p>
  
  <p><strong>Description</strong><br>
  The Windows 2003 hosts a WCF service inventory, services within are well tested.<br>
  When an application consumer runs inside windows 2003 - everything works fine.<br>
  When an application consumer runs from Windows Vista (under this virtual network) - security problems appears. So it was needed to adjust de service and include a certificate. Documentation was followed but the access still denied.</p>
  
  <p><strong>Purpose</strong><br>
  No sophisticated security arrangements is needed - its simply a laptop and virtual machine. 
  I tried to replicate this official scenario: <a href="http://msdn.microsoft.com/en-us/library/ms733938.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/ms733938.aspx</a> <br>
  I want make calls to services hosted on windows 2003 from my application under Windows Vista OS using the Unit Test application (nunit). The deployed services on windows 2003 is a well tested ones.</p>
  
  <p><strong>WHAT WORKS</strong><br> 
  Any service using  (or past .asmx webservices) works properly.</p>
  
  <p><strong>Suspicion</strong><br>
  I believe it has to be with this dammed Windows Vista. The Windows 2003 event log has successful auditing entries.</p>
  
  <p><strong>SERVICE SETTINGS</strong><br></p>
  
  <p>The consumer - nunit application running on Windows Vista:</p>
  
  <pre><code>&lt;system.serviceModel&gt;
  &lt;client&gt;
    &lt;endpoint address="http://soa.homolog.com/RemoteService/RemoteService.svc"
        binding="wsHttpBinding"
        behaviorConfiguration="InternetEndpointBehavior" 
        bindingConfiguration="AnonymousBindingConfiguration"
        contract="RemoteService.IRemoteService" 
        name="WSHttpBinding_IEmpresaService"&gt;
      &lt;identity&gt;
        &lt;dns value="homologCertificate"  /&gt;
      &lt;/identity&gt;
    &lt;/endpoint&gt;
  &lt;/client&gt;
  &lt;bindings&gt;
    &lt;wsHttpBinding&gt;
      &lt;binding name="AnonymousBindingConfiguration"&gt;
        &lt;security mode="Message"&gt;
          &lt;message clientCredentialType="None" /&gt;            
        &lt;/security&gt;
      &lt;/binding&gt;
   &lt;/bindings&gt;
   &lt;behaviors&gt;
   &lt;endpointBehaviors&gt;
      &lt;behavior name="InternetEndpointBehavior"&gt;
        &lt;clientCredentials&gt;
          &lt;serviceCertificate&gt;
            &lt;authentication certificateValidationMode="None" /&gt;
          &lt;/serviceCertificate&gt;
        &lt;/clientCredentials&gt;
      &lt;/behavior&gt;
    &lt;/endpointBehaviors&gt;
   &lt;/behaviors&gt;
  &lt;/system.serviceModel&gt;
  </code></pre>
  
  <p>The service, hosted on IIS/Windows 2003:</p>
  
  <pre><code>&lt;system.serviceModel&gt;
  &lt;serviceHostingEnvironment&gt;
    &lt;baseAddressPrefixFilters&gt;
      &lt;add prefix="http://soa.homolog.com" /&gt;
    &lt;/baseAddressPrefixFilters&gt;
  &lt;/serviceHostingEnvironment&gt;
  &lt;bindings&gt;
  
    &lt;wsHttpBinding&gt;
      &lt;binding name="BindingNoSecurity"&gt;          
        &lt;security mode="Message"&gt;
          &lt;message clientCredentialType="None"/&gt;
        &lt;/security&gt;
      &lt;/binding&gt;
    &lt;/wsHttpBinding&gt;
  &lt;/bindings&gt;
  &lt;behaviors&gt;
    &lt;serviceBehaviors&gt;
      &lt;behavior name="CompanyCoreBehavior"&gt;
  
        &lt;serviceMetadata httpGetEnabled="true" /&gt;
        &lt;serviceDebug 
                includeExceptionDetailInFaults="true" /&gt;
        &lt;serviceThrottling 
                maxConcurrentCalls="500" 
                maxConcurrentInstances="500" 
                maxConcurrentSessions="500" /&gt;
        &lt;serviceTimeouts 
                transactionTimeout="00:10:00" /&gt;
  
        &lt;serviceCredentials&gt;
          &lt;serviceCertificate
                      findValue="homologCertificate"
                      storeLocation="LocalMachine"
                      x509FindType="FindBySubjectName"
                      storeName="My"/&gt;
        &lt;/serviceCredentials&gt;
      &lt;/behavior&gt;
    &lt;/serviceBehaviors&gt;
  &lt;/behaviors&gt;
  </code></pre>
  
  <p></p>