I have a customizedBinding where iam adding various bindings in the CreateBindingElemens method. Everything works great if I have the HttpTransportBindingElement, but as a next step i want to add transport security (ssl) to it, so i modified the code like this
BindingElementCollection collection = new BindingElementCollection();
collection.Add(httpPollingElement);
if (session == SessionType.HttpSession)
{
collection.Add(httpSessionElement);
}
else
{
collection.Add(reliableSessionElement);
}
collection.Add(encodingElement);
var securityBindingElement = new TransportSecurityBindingElement();
collection.Add(securityBindingElement);
collection.Add(httpTransportElement);
return collection;
but iam getting an error saying The security capabilities of binding ‘System.ServiceModel.Channels.CustomBinding’ do not match those of the generated runtime object. Most likely this means the binding contains a StreamSecurityBindingElement, but lacks a TransportBindingElement that supports Stream Security (such as TCP or Named Pipes). Either remove the unused StreamSecurityBindingElement or use a transport that supports this element.
I can confirm that i dont have StramSecurityBindingElement in my configuration. Which security bindings should i be adding in order to make this work ?
To use ssl just add:
instead of the http element.
no need to add security element when only transport security is used.