我的公司使用WIF(Windows Identity Foundation)来保护我们的服务。目前我们只使用基于HTTPS的WIF。但是,我们需要保护TCP端点,并且遇到了一些麻烦。
我遇到了以下异常:
The '{binding name}'.'http://tempuri.org/' binding for the '{IService}'.
'http://tempuri.org/' contract is configured with an authentication mode that requires
transport level integrity and confidentiality. However the transport cannot provide
integrity and confidentiality.
为了将WIF纳入图片,我们必须在服务主机内执行此操作:
var istp = new IssuedSecurityTokenParameters(_TokenType, _IssuerAddress, _IssuerBinding) // issuer address/binding do not matter for this, but must provide something
{
RequireDerivedKeys = false,
KeyType = System.IdentityModel.Tokens.SecurityKeyType.BearerKey
};
TransportSecurity = new TransportSecurityBindingElement();
TransportSecurity.EndpointSupportingTokenParameters.Signed.Add(istp);
TransportSecurity.MessageSecurityVersion = MessageSecurityVersion.WSSecurity11WSTrust13WSSecureConversation13WSSecurityPolicy12;
我不能把这些代码排除,但是我不知道我缺少什么配置来使用TCP。任何帮助都会很棒。