user2412130
user2412130

Reputation: 55

Wcf basicHttpBinding not working in Windows 8.1 app store

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

Answers (1)

Leon Pro
Leon Pro

Reputation: 106

  • Deploy a WCF service on IIS Local (because IIS Express are not so flexible), set off Anonymous Authentication and set on Windows Integrated Authentication.
  • make service reference in target Win 8 app.
  • 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

  • profit

Upvotes: 1

Related Questions