Reputation: 55
I wrote a Wcf Service and its configuration file is
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="MyServiceTypeBehaviors" >
<serviceMetadata httpGetEnabled="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<basicHttpBinding>
<binding name="securityDemo">
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Windows" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<services>
<service name="WcfDemo.EmpService" behaviorConfiguration="MyServiceTypeBehaviors">
<host>
<baseAddresses>
<add baseAddress="http://localhost:3003/"/>
</baseAddresses>
</host>
<endpoint address="" binding="basicHttpBinding" contract="WcfDemo.IEmpService" bindingConfiguration="securityDemo"/>
</service>
</services>
</system.serviceModel>
This working fine for a console app or WPF app. But when I am using same service for windows 8.1 app i am getting this exception
The HTTP request is unauthorized with client authentication scheme 'Negotiate'. The authentication header received from the server was 'Negotiate,NTLM'.
Upvotes: 1
Views: 494
Reputation: 106
before using Service proxy add a lines with identification:
var client = new ServiceReference1.Service1Client();
client.ClientCredentials.Windows.ClientCredential.UserName = "windows user name";
client.ClientCredentials.Windows.ClientCredential.Password = "user passw";
call a service method
Upvotes: 1