WCF Gets Denied Access When a Consumer Attempts to Call WCF Service Calls Hosted in a Virtual Machine

Problem

System.ServiceModel.Security.SecurityAccessDeniedException : Access is denied.

Corresponding stack lines (reduced)

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)

Environment
Developer machine (host): Windows Vista, Visual Studio 2008, nUnit
Test machine (guest): Windows 2003, IIS, Windows 2003 firewall (disabled)
Virtual machine: virtual computer
Network: Microsoft Loopback adapter


Windows 2003 WCF, .
Windows 2003 - .
Windows Vista ( ), . . , .


- . : http://msdn.microsoft.com/en-us/library/ms733938.aspx
, Windows 2003, Windows Vista Unit Test (nunit). Windows 2003 .


, ( - .asmx), .


, Windows Vista. Windows 2003 .


--nunit, Windows Vista:

<system.serviceModel>
<client>
  <endpoint address="http://soa.homolog.com/RemoteService/RemoteService.svc"
      binding="wsHttpBinding"
      behaviorConfiguration="InternetEndpointBehavior" 
      bindingConfiguration="AnonymousBindingConfiguration"
      contract="RemoteService.IRemoteService" 
      name="WSHttpBinding_IEmpresaService">
    <identity>
      <dns value="homologCertificate"  />
    </identity>
  </endpoint>
</client>
<bindings>
  <wsHttpBinding>
    <binding name="AnonymousBindingConfiguration">
      <security mode="Message">
        <message clientCredentialType="None" />            
      </security>
    </binding>
 </bindings>
 <behaviors>
 <endpointBehaviors>
    <behavior name="InternetEndpointBehavior">
      <clientCredentials>
        <serviceCertificate>
          <authentication certificateValidationMode="None" />
        </serviceCertificate>
      </clientCredentials>
    </behavior>
  </endpointBehaviors>
 </behaviors>
</system.serviceModel>

, IIS/Windows 2003:

<system.serviceModel>
<serviceHostingEnvironment>
  <baseAddressPrefixFilters>
    <add prefix="http://soa.homolog.com" />
  </baseAddressPrefixFilters>
</serviceHostingEnvironment>
<bindings>

  <wsHttpBinding>
    <binding name="BindingNoSecurity">          
      <security mode="Message">
        <message clientCredentialType="None"/>
      </security>
    </binding>
  </wsHttpBinding>
</bindings>
<behaviors>
  <serviceBehaviors>
    <behavior name="CompanyCoreBehavior">

      <serviceMetadata httpGetEnabled="true" />
      <serviceDebug 
              includeExceptionDetailInFaults="true" />
      <serviceThrottling 
              maxConcurrentCalls="500" 
              maxConcurrentInstances="500" 
              maxConcurrentSessions="500" />
      <serviceTimeouts 
              transactionTimeout="00:10:00" />

      <serviceCredentials>
        <serviceCertificate
                    findValue="homologCertificate"
                    storeLocation="LocalMachine"
                    x509FindType="FindBySubjectName"
                    storeName="My"/>
      </serviceCredentials>
    </behavior>
  </serviceBehaviors>
</behaviors>

+3
2

System.ServiceModel.Security, , , IIS.

:

  <clientCredentials> 
    <serviceCertificate> 
      <authentication certificateValidationMode="None" /> 
    </serviceCertificate> 
  </clientCredentials> 

:

  <serviceCredentials>  
    <serviceCertificate  
                findValue="homologCertificate"  
                storeLocation="LocalMachine"  
                x509FindType="FindBySubjectName"  
                storeName="My"/>  
  </serviceCredentials>  
0

WCF . . , , . , , , .

0

Source: https://habr.com/ru/post/1765814/


All Articles