Click here to Skip to main content
15,887,998 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
BasicHttpBinding Funct_LocalBinding = new BasicHttpBinding();
                  EndpointAddress Funct_LocalEndpoint = new EndpointAddress("http://172.16.50.149:1546/BTA_Service.svc");
                  Funct_LocalBinding.Security.Mode = BasicHttpSecurityMode.TransportCredentialOnly;
                  Funct_LocalBinding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Windows;
                  Funct_LocalBinding.Security.Transport.ProxyCredentialType=HttpProxyCredentialType.None;
                  Funct_LocalBinding.Security.Transport.Realm="";
                  Funct_LocalBinding.Security.Message.ClientCredentialType=BasicHttpMessageCredentialType.UserName;
                  Funct_LocalBinding.Security.Message.AlgorithmSuite=SecurityAlgorithmSuite.Default;
                  BTA_ServiceClient serverObject = new BTA_ServiceClient(Funct_LocalBinding, Funct_LocalEndpoint);
                  serverObject.ClientCredentials.Windows.ClientCredential = System.Net.CredentialCache.DefaultNetworkCredentials;
                  serverObject.ClientCredentials.Windows.AllowNtlm = true;
                  serverObject.ClientCredentials.UseIdentityConfiguration = true;
                  serverObject.ClientCredentials.Windows.AllowedImpersonationLevel =System.Security.Principal.TokenImpersonationLevel.Impersonation;
                  var str = serverObject.FlightCode_Validation(new PNRModel()
                  {
                      Flight_Code = "AA",
                      RequestId = "4"
                  }
                        );


error:
{"The HTTP request is unauthorized with client authentication scheme 'Negotiate'. The authentication header received from the server was 'Negotiate,NTLM'."}


What I have tried:

My Wcf Service config

<?xml version="1.0"?>
<configuration>
  <appSettings>
    <add key="InfiServiceUrl" value="http://172.16.50.146:1717/InfiService.svc/BTAValidation"/>
    <add key="Islogging" value="Y"/>
    <add key="LogFilePath" value="C:\BTA_Exception\Log\"/>
  </appSettings>
  <!--
    For a description of web.config changes see http://go.microsoft.com/fwlink/?LinkId=235367.

    The following attributes can be set on the <httpRuntime> tag.
      <system.Web>
        <httpRuntime targetFramework="4.5" />
      </system.Web>
  -->
  <system.web>
    <compilation debug="true" targetFramework="4.5"/>
    <pages controlRenderingCompatibilityVersion="4.0"/>
  </system.web>
  <connectionStrings>
    <add name="GDS_Connection" connectionString="F5XGWMkZIKnvmeKRLmDIs85gfShEhVsCb31D96JcpdLpltZWV3RBdpfwwCVPeOPz5EcrGS0/6c2N/s3sV9TIiNokGMnzuptigq6kJQHbpAWo6G0mBWlIag=="/>
  </connectionStrings>
  <system.serviceModel>
    <services>
      <service name="BTA_WCF_Service.BTA_Service">
        <endpoint address="" binding="basicHttpBinding" bindingConfiguration="TransportSecurity" contract="BTA_WCF_Service.IBTA_Service"/>
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
      </service>
    </services>
    <bindings>
      <basicHttpBinding>
        <binding name="TransportSecurity">
          <security mode="TransportCredentialOnly">
            <transport clientCredentialType="Windows"/>
          </security>
        </binding>
      </basicHttpBinding>
    </bindings>
    <behaviors>
      <serviceBehaviors>
        <behavior>
          <serviceMetadata httpGetEnabled="true"/>
          <serviceDebug includeExceptionDetailInFaults="false"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="True"/>
  </system.serviceModel>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
    <directoryBrowse enabled="true"/>
  </system.webServer>
</configuration>
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900