Access the WCF service with integrated Windows authentication from a Windows service using a local SYSTEM account

We have a WCF service using integrated Windows authentication deployed on a dedicated server. There are Windows Service on Client computers [Windows service uses a local system account]. We get an error when the WCFServiceClient in the Windows service accesses the WCF service. [If the Windows service is running on the server machine, it is working fine]

System.ServiceModel.Security.MessageSecurityException: The HTTP request is unauthorized with client authentication scheme 'Negotiate'. The authentication header received from the server was 'Negotiate,NTLM'. ---> System.Net.WebException: The remote server returned an error: (401) Unauthorized.
   at System.Net.HttpWebRequest.GetResponse()
   at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)

We cannot allow anonymous access or cannot remove Windows authentication from the WCF service. Is there any way around this problem.

Client Side Configuration

<basicHttpBinding>
        <binding name="BasicServiceHttpBinding">
          <security mode="TransportCredentialOnly">
            <transport clientCredentialType="Windows" proxyCredentialType="None"
              realm="" />
            <message clientCredentialType="UserName" algorithmSuite="Default" />
          </security>
        </binding>
</basicHttpBinding>

Server configuration

 <basicHttpBinding>
        <binding>
          <security mode="TransportCredentialOnly">
            <transport clientCredentialType="Windows" />
          </security>
        /binding>
  </basicHttpBinding>
+3

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


All Articles