예제 #1
0
        public void WanneerIngelogdDanGeenException()
        {
            callback = new ClientUpdateCallback();
            var binding = new NetTcpBinding(SecurityMode.Message);
            binding
                .Security
                .Message
                .ClientCredentialType =
                    MessageCredentialType.UserName;

            var factory = new DuplexChannelFactory<IService>(callback,
                binding,
                new EndpointAddress("net.tcp://localhost:6789"));

            factory.Credentials.UserName.UserName = "******";
            factory.Credentials.UserName.Password = "******";

            factory.Credentials.ServiceCertificate.SetDefaultCertificate(StoreLocation.LocalMachine, StoreName.My, X509FindType.FindBySubjectName, "localhost");
            factory.Credentials.ServiceCertificate.Authentication.CertificateValidationMode = X509CertificateValidationMode.None;

            client = factory.CreateChannel();

            client.Secure();
        }