C# Programming
07-10-2009, 10:51 AM
My WCF properly working when SecurityMode.None. If I switch to SecurityMode.Message so it is not work in client side. My main problem is how can I encrypt to message in WCF?
Following code OK, its work;
Host Side Code
---------------------------------------------------------------------
NetTcpBinding tcpBinding = new NetTcpBinding(SecurityMode.None);
Uri tcpUri = new Uri("net.tcp://10.0.105.240:7070/HesaplamaServisi");
ServiceHost host = new ServiceHost(typeof(Hesaplayici), tcpUri);
host.Description.Behaviors.Add(new ServiceMetadataBehavior());
host.AddServiceEndpoint(typeof(IHesaplamalar), tcpBinding, "net.tcp://10.0.105.240:7070/HesaplamaServisi");
host.AddServiceEndpoint(typeof(IMetadataExchange), System.ServiceModel.Description.MetadataExchangeBindings.CreateMexTcpBinding(), "mex");
host.Open();
Client Side Code
---------------------------------------------------------------------
NetTcpBinding tcpBinding = new NetTcpBinding(SecurityMode.None);
IHesaplamalar proxy = ChannelFactory.CreateChannel(tcpBinding, new EndpointAddress("net.tcp://10.0.105.240:7070/HesaplamaServisi/"));
FOLLOWING NOT WORK
---------------------------------------------------------------------
I want encrypt to message, so I add following code both side;
NetTcpBinding tcpBinding = new NetTcpBinding(SecurityMode.Message);
tcpBinding.Security.Message.AlgorithmSuite = System.ServiceModel.Security.SecurityAlgorithmSuite.TripleDesSha256Rsa15;
This code properly work when Host and Client same PC, If client.exe run another PC in same network this code not work. What can I do? Thanks...
Following code OK, its work;
Host Side Code
---------------------------------------------------------------------
NetTcpBinding tcpBinding = new NetTcpBinding(SecurityMode.None);
Uri tcpUri = new Uri("net.tcp://10.0.105.240:7070/HesaplamaServisi");
ServiceHost host = new ServiceHost(typeof(Hesaplayici), tcpUri);
host.Description.Behaviors.Add(new ServiceMetadataBehavior());
host.AddServiceEndpoint(typeof(IHesaplamalar), tcpBinding, "net.tcp://10.0.105.240:7070/HesaplamaServisi");
host.AddServiceEndpoint(typeof(IMetadataExchange), System.ServiceModel.Description.MetadataExchangeBindings.CreateMexTcpBinding(), "mex");
host.Open();
Client Side Code
---------------------------------------------------------------------
NetTcpBinding tcpBinding = new NetTcpBinding(SecurityMode.None);
IHesaplamalar proxy = ChannelFactory.CreateChannel(tcpBinding, new EndpointAddress("net.tcp://10.0.105.240:7070/HesaplamaServisi/"));
FOLLOWING NOT WORK
---------------------------------------------------------------------
I want encrypt to message, so I add following code both side;
NetTcpBinding tcpBinding = new NetTcpBinding(SecurityMode.Message);
tcpBinding.Security.Message.AlgorithmSuite = System.ServiceModel.Security.SecurityAlgorithmSuite.TripleDesSha256Rsa15;
This code properly work when Host and Client same PC, If client.exe run another PC in same network this code not work. What can I do? Thanks...