Skip to content

Instantly share code, notes, and snippets.

@yaronn
Created October 26, 2013 13:24
Show Gist options
  • Save yaronn/7169437 to your computer and use it in GitHub Desktop.
Save yaronn/7169437 to your computer and use it in GitHub Desktop.
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");
}
}
}
@yaronn
Copy link
Author

yaronn commented Jul 23, 2015

disable wcf signature body header part

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment