WCF TCP传输绑定 - 自定义方案?

时间:2014-11-12 13:09:54

标签: c# wcf soap binding tcp

我试图为我的自定义TCP传输绑定提供自定义方案,但是在启动服务主机时,它总是告诉我那个' net.tcp'预计:

public class MyTcpBinding: Binding
{

    private readonly MyTcpTransportBindingElement _transport;
    private readonly BinaryMessageEncodingBindingElement _binaryEncoding;

    public override string Scheme
    {
        get { return "my.tcp"; }
    }

    public MyTcpBinding()
    {
        _transport      = new MyTcpTransportBindingElement();
        _binaryEncoding = new BinaryMessageEncodingBindingElement();
    }

    public override BindingElementCollection CreateBindingElements()
    {
        return new BindingElementCollection(new BindingElement[]
        {
            _binaryEncoding, _transport
        });
    }
}

public class MyTcpTransportBindingElement : TcpTransportBindingElement
{
    public override string Scheme
    {
        get { return "my.tcp"; }
    }
}

可以做些什么来解决这个问题?

0 个答案:

没有答案