Я добавил сервисную ссылку ASMX
в свой проект, щелкнув правой кнопкой мыши на корне -> добавить сервисную ссылку.
У меня так в моем web.config
файле:
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="xxx" />
</basicHttpBinding>
</bindings>
<client>
<endpoint address="serviceaddress"
binding="basicHttpBinding" bindingConfiguration="xxx"
contract="xxx" name="xxx" />
</client>
</system.serviceModel>
У этой службы есть метод, который получает string
с именем пользователя и проверяет, существует ли он.
Проблема в том, что я тестирую его на Postman
, и он возвращает следующее сообщение об ошибке:
The content type text/html; charset=UTF-8 of the response message does not match the content type
Я уже проверял другие сообщения, подобные этому, но яЯ не могу найти решение.
Вот метод, который я вызываю и который выдает ошибку:
public static List<UserInformation> GetUsersByUserName(string userName)
{
try
{
var usersServiceClient = new LDapServicesSoapClient();
var requestMessage = new LDapUserNameLookupRequest();
requestMessage.UserName = userName;
requestMessage.AccessKey = "secretkey";
var response = usersServiceClient.LDapGetUserByUserName(requestMessage);
return response.Users.ToList();
}
catch (CommunicationException e)
{
if (e.InnerException is QuotaExceededException)
{
throw new Exception("We have found many users, please write another filter");
}
else
{
throw new Exception(e.Message, e);
}
}
}