1

I am calling a WCF service from console app, I do not have any control on WCF service.

this console app works fine on my development system and one 2008 server, When I move it to server running windows 2012 it gives error The HTTP request is unauthorized with client authentication scheme 'Negotiate'. The authentication header received from the server was 'Negotiate,NTLM'

app config file contains

  <system.serviceModel>
<bindings>
  <basicHttpBinding>
    <binding name="ServiceNameSoap" maxBufferSize="5242880" maxReceivedMessageSize="5242880">
      <security mode="TransportCredentialOnly">
        <transport clientCredentialType="Windows"/>
      </security>
    </binding>
  </basicHttpBinding>
</bindings>
<client>
  <endpoint address="http://someCompanyurl.com/ServiceName" binding="basicHttpBinding" bindingConfiguration="ServiceNameSoap" contract="ServiceName.ServiceNameSoap" name="ServiceNameSoap"/>  
</client>

actual code is

ServiceNameSoapClient proxy = new ServiceNameSoapSoapClient();

        proxy.ClientCredentials.Windows.ClientCredential.Domain = connStringParts[DOMAIN];
        proxy.ClientCredentials.Windows.ClientCredential.UserName = connStringParts[USER_NAME];
        proxy.ClientCredentials.Windows.ClientCredential.Password = connStringParts[PASSWORD];
        proxy.ClientCredentials.Windows.AllowedImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Delegation;

        RequestHeader soapHeader = new RequestHeader();
        soapHeader.clientApplicationName = ConfigurationManager.AppSettings["clientApplicationName"];

        ServiceNameRequestCollection request = new ServiceNameRequestCollection();

        adding some flags to request


        Response = proxy.Method(soapHeader, request, out Response);

I have searched extensively, haven't fond any solution .

any setting missing or configuration missing on 2012 server?

have tried changing Ntlm to Windows and Vice versa . same error, negotiate changes to ntlm in error message.

Thanks

sanjay
  • 131
  • 1
  • 8
  • Does https://stackoverflow.com/questions/13704720/the-http-request-is-unauthorized-with-client-authentication-scheme-ntlm-the-a or https://gist.github.com/Krizzzn/3127827 help? – mjwills Aug 09 '17 at 12:57
  • @mjwills I had checked 1st link earlier , 2nd link of no use. I tried [wftech](https://support.microsoft.com/en-us/help/284285/how-to-use-wfetch-exe-to-troubleshoot-http-connections). Now when I use wftech @ dev system and WS2008, Negotiate fails but NTLM works, but on WS2012 Both fail. – sanjay Aug 09 '17 at 15:19
  • WCF team changed some security setting on their hosting server( they had migrated from Physical to VMs) and client has started to work on all client servers now. Please close this tread – sanjay Aug 11 '17 at 10:18

0 Answers0