CreateBindingElemens メソッドにさまざまなバインディングを追加する、customizedBinding があります。HttpTransportBindingElement があればすべてうまく機能しますが、次のステップとしてトランスポート セキュリティ (ssl) を追加したいので、次のようにコードを変更しました。
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;
しかし、バインド 'System.ServiceModel.Channels.CustomBinding' のセキュリティ機能が、生成されたランタイム オブジェクトのセキュリティ機能と一致しないというエラーが表示されます。これはおそらく、バインディングに StreamSecurityBindingElement が含まれているが、ストリーム セキュリティ (TCP や名前付きパイプなど) をサポートする TransportBindingElement がないことを意味します。未使用の StreamSecurityBindingElement を削除するか、この要素をサポートするトランスポートを使用してください。
構成に StramSecurityBindingElement がないことを確認できます。これを機能させるには、どのセキュリティ バインディングを追加する必要がありますか?