Ejemplo n.º 1
0
 static void Main(string[] args)
 {
     try
     {
         SecuredMessageServiceClient ClientProxy = new SecuredMessageServiceClient();
         ClientProxy.ClientCredentials.UserName.UserName = "******";
         ClientProxy.ClientCredentials.UserName.Password = "******";
         ClientProxy.SaySecuredMessage("Rameshkartik");
         Console.WriteLine("Message Sent to SecuredMessage Service");
         Console.ReadKey();
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
     }
 }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            EndpointAddress endpoint = new EndpointAddress("http://localhost:8735/Rameshkartik/WCFSamples/SecuredMessageService");
            WSHttpBinding   binding  = new WSHttpBinding();

            binding.Security.Mode = SecurityMode.Message;
            binding.Security.Message.ClientCredentialType = MessageCredentialType.Windows;
            SecuredMessageServiceClient ProxyRefrence = new SecuredMessageServiceClient(binding, endpoint);

            ProxyRefrence.Open();
            System.AppDomain.CurrentDomain.SetPrincipalPolicy(System.Security.Principal.PrincipalPolicy.WindowsPrincipal);
            ProxyRefrence.SaySecuredMessage("Ramesh");
            Console.WriteLine("Message Sent");
            Console.ReadKey();
            ProxyRefrence.Close();
        }
Ejemplo n.º 3
0
        static void Main(string[] args)
        {
            EndpointAddress endpoint = new
                                       EndpointAddress(new Uri("http://localhost:8733/Rameshkartik/WCFSamples/MessageSecurity/SecuredMessageService"), EndpointIdentity.CreateDnsIdentity("ServiceCert"));
            WSHttpBinding binding = new WSHttpBinding();

            binding.Security.Mode = SecurityMode.Message;
            binding.Security.Message.ClientCredentialType = MessageCredentialType.UserName;

            SecuredMessageServiceClient ProxyRefrence = new SecuredMessageServiceClient(binding, endpoint);

            ProxyRefrence.ClientCredentials.UserName.UserName = "******";
            ProxyRefrence.ClientCredentials.UserName.Password = "******";
            ProxyRefrence.ClientCredentials.ServiceCertificate.Authentication.CertificateValidationMode = X509CertificateValidationMode.None;
            ProxyRefrence.SayHello("Ramesh");
            Console.WriteLine("Message Sent");
            Console.ReadKey();
        }
Ejemplo n.º 4
0
        static void Main(string[] args)
        {
            EndpointAddress endpoint = new EndpointAddress("http://localhost:8735/Rameshkartik/WCFSamples/SecuredMessageService");
            WSHttpBinding   binding  = new WSHttpBinding();

            binding.Security.Mode = SecurityMode.Message;
            binding.Security.Message.ClientCredentialType = MessageCredentialType.Windows;
            SecuredMessageServiceClient ProxyRefrence = new SecuredMessageServiceClient(binding, endpoint);

            ProxyRefrence.Open();
            ProxyRefrence.SaySecuredMessage("Ramesh");
            ChannelFactory <ISecuredMessageService> cf = new ChannelFactory <ISecuredMessageService>(binding, endpoint);

            cf.Credentials.Windows.AllowedImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Impersonation;
            ISecuredMessageService iServiceMethod = cf.CreateChannel();

            iServiceMethod.LogMessage("Hi Hru");
            //ProxyRefrence.LogMessage("Hi Howru");
            Console.WriteLine("Message Sent");
            Console.ReadKey();
            ProxyRefrence.Close();
        }