Created
          October 26, 2013 13:24 
        
      - 
      
- 
        Save yaronn/7169437 to your computer and use it in GitHub Desktop. 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | namespace ConsoleApplication309 | |
| { | |
| public class B : IEndpointBehavior | |
| { | |
| #region IEndpointBehavior Members | |
| public void AddBindingParameters(ServiceEndpoint endpoint, System.ServiceModel.Channels.BindingParameterCollection bindingParameters) | |
| { | |
| MessagePartSpecification m = new MessagePartSpecification(); | |
| m.IsBodyIncluded = true; | |
| var c = bindingParameters.Remove<ChannelProtectionRequirements>(); | |
| var c1 = new ChannelProtectionRequirements(); | |
| c1.IncomingSignatureParts.AddParts(m, "*"); | |
| MessagePartSpecification m1 = new MessagePartSpecification(); | |
| m.IsBodyIncluded = false; | |
| c1.IncomingEncryptionParts.AddParts(m1, "*"); | |
| bindingParameters.Add(c1); | |
| } | |
| public void ApplyClientBehavior(ServiceEndpoint endpoint, System.ServiceModel.Dispatcher.ClientRuntime clientRuntime) | |
| { | |
| } | |
| public void ApplyDispatchBehavior(ServiceEndpoint endpoint, System.ServiceModel.Dispatcher.EndpointDispatcher endpointDispatcher) | |
| { | |
| } | |
| public void Validate(ServiceEndpoint endpoint) | |
| { | |
| } | |
| #endregion | |
| } | |
| class Program | |
| { | |
| static void Main(string[] args) | |
| { | |
| ServiceReference1.SimpleServiceSoapClient c= new ConsoleApplication309.ServiceReference1.SimpleServiceSoapClient(); | |
| c.ChannelFactory.Endpoint.Behaviors.Add(new B()); | |
| //c.ChannelFactory.Endpoint.Contract.ProtectionLevel = System.Net.Security.ProtectionLevel.Sign; | |
| c.EchoString("1"); | |
| } | |
| } | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
            
disable wcf signature body header part