How to make WCF Client conform to specific WS-Security - sign UsernameToken and SecurityTokenReference

前端 未结 2 673
野趣味
野趣味 2020-12-14 01:45

I need to create a wcf client to call a service that I have no control over.

I have been given a wsdl and a working soapui project.

The service uses both a

2条回答
  •  鱼传尺愫
    2020-12-14 02:19

    Maybe it's because your certificate is not publicly valid. Try this:

    System.Net.ServicePointManager.ServerCertificateValidationCallback = new System.Net.Security.RemoteCertificateValidationCallback(delegate { return true; });
    //...
    using (var client = new SrvClient())
    {
        client.ClientCredentials.UserName.UserName = "usr";
        client.ClientCredentials.UserName.Password = "psw";
        //...
    }
    

提交回复
热议问题