Silverlight 4 NetTcpBinding 编程配置
我想以编程方式为 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 运行时必须以某种方式执行此操作。
I'd like to configure a NetTcpBinding programatically for a silverlight 4 client. (NetTcpBinding is now supported)
Here is the code I use to do this for a Windows Forms client:
EndpointAddress endpointAddress = new EndpointAddress(uri);
NetTcpBinding netTcpBinding = new NetTcpBinding();
MyServiceClient agentClient = new MyServiceClient(new InstanceContext(this), netTcpBinding, endpointAddress);
For silverlight I added references to System.ServiceModel.Extensions and System.ServiceModel.NetTcp, but this is not not enough : I'm not able to find a NetTcpBinding class.
Where is this class if it exists? Does an equivalent syntax exists? The silverlight 4 runtime must be doing this somehow when a configuration file is used.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用自定义绑定代替 NetTcpBinding :下面的代码可以正常工作,但我不知道这是否是推荐的模式。
You can use a custom binding in place of NetTcpBinding : the code below is working, but I don't know if this is the recommended pattern.