Я пытаюсь выполнить вызов веб-службы SOAP с использованием аутентификации NTLM, но это не работает.
Я использовал службу WSDL.
Что я сделал до сих пор:
BasicHttpBinding binding = new BasicHttpBinding();
EndpointAddress address = new EndpointAddress("http://uri.test/");
_client = new TEST_PortClient(binding, address);
if (_client.ClientCredentials != null)
{
_client.ClientCredentials.Windows.AllowNtlm = true; // this method is deprecated
_client.ClientCredentials.Windows.ClientCredential.UserName = "username";
_client.ClientCredentials.Windows.ClientCredential.Password = "password";
}
_client.Open(); // this works successfully
string message = string.Empty;
if (_client.TestConnection(ref message)) // this throw an exception *
{
// do something
}
Исключение:
The HTTP request is unauthorized with client authentication scheme 'Anonymous'. The authentication header received from the server was 'NTLM'.
Что я должен сделать, чтобы это работало?