我想以编程方式为 silverlight 4 客户端配置 NetTcpBinding。(现在支持 NetTcpBinding)
这是我用来为 Windows 窗体客户端执行此操作的代码:
EndpointAddress endpointAddress = new EndpointAddress(uri);
NetTcpBinding netTcpBinding = new NetTcpBinding();
MyServiceClient agentClient = new MyServiceClient(new InstanceContext(this), netTcpBinding, endpointAddress);
对于 silverlight,我添加了对 System.ServiceModel.Extensions 和 System.ServiceModel.NetTcp 的引用,但这还不够:我找不到 NetTcpBinding 类。
如果存在这个类,它在哪里?是否存在等效语法?使用配置文件时,silverlight 4 运行时必须以某种方式执行此操作。