@Lion6666

Подключение к WCF-сервису, блок Security. В чем проблема?

Добрый день всем. Пытаюсь подключиться к WCF-сервису, используется стандарт WS-Security. Для подписи запросов используется сертификат:
<clientCredentials>
    <clientCertificate x509FindType="FindBySubjectName"
                       storeLocation="CurrentUser"
                       storeName="My"
                       findValue="Тестовый НБКИ - 2016-07"/>
    <serviceCertificate>
        <authentication certificateValidationMode="None" />
    </serviceCertificate>
</clientCredentials>

Вот сама точка подключения:
<endpoint address="https://ips.rosminzdrav.ru/5358bf30e7897"
   behaviorConfiguration="ipsErBeh" binding="wsHttpBinding" bindingConfiguration="newBinding"
   contract="ipsWorkMisService.misInterface" name="ipsWorkEndPoint"/>

И используемый binding:
<wsHttpBinding>
    <binding name="newBinding" maxReceivedMessageSize="2147483647"
             messageEncoding="Text">
        <security mode="TransportWithMessageCredential"> 
            <message clientCredentialType="Certificate" />
        </security>
    </binding>
</wsHttpBinding>

В блок Security докидывается необходимое:
ipsWorkMisService.misInterfaceClient ms = new misInterfaceClient("ipsWorkEndPoint");

if (security != null)
{
    X509SecurityTokenParameters tokenParameters = new X509SecurityTokenParameters();
    tokenParameters.InclusionMode = SecurityTokenInclusionMode.AlwaysToRecipient;
    tokenParameters.RequireDerivedKeys = false;
    security.EndpointSupportingTokenParameters.SignedEncrypted.Add(tokenParameters);
    security.EndpointSupportingTokenParameters.SignedEncrypted.Add(new UserNameSecurityTokenParameters());
}
ms.Endpoint.Binding = new CustomBinding(elements.ToArray());

Но при попытке подключения сервер выдаёт ошибку "Проверка блока security: не найден элемент header\TransportHeader". Просьба подсказать: в чем может быть дело? Элемент header на месте, насколько я понимаю. Заранее спасибо за ответы!
  • Вопрос задан
  • 244 просмотра
Пригласить эксперта
Ответы на вопрос 1
OrenTiger
@OrenTiger
.NET Developer
Попробуйте поменять конфигурацию элемента security на:
<security mode="Transport">  
  <transport clientCredentialType="Certificate"/>
</security>


See link: Transport Security with Certificate Authentication
Ответ написан
Комментировать
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы