Window 8 metro The HTTP request is unauthorized with client authentication scheme 'Anonymous'. The authentication header received from the server was
public static ListsService.ListsSoapClient GetService(string uri)
{
System.ServiceModel.BasicHttpBinding binding = new System.ServiceModel.BasicHttpBinding();
binding.MaxReceivedMessageSize =int.MaxValue;
binding.MaxBufferSize =int.MaxValue;
binding.Security.Mode =BasicHttpSecurityMode.TransportCredentialOnly;
binding.Security.Transport.ClientCredentialType =HttpClientCredentialType.Ntlm;
if (uri != null)
{
System.ServiceModel.EndpointAddress address = new System.ServiceModel.EndpointAddress(uri);
try
{
return new ListsService.ListsSoapClient(binding, address);
}
catch (Exception)
{
}
}
return null;
}