WCF如何通过代码创建TCP协议的双工客户端通信

Chenzhit 2009-10-26 04:47:19
我现在的客户端的绑定和地址以及创建端点都是通过配置文件来实现的: <system.serviceModel>
<bindings>
<netTcpBinding>
<binding name="NetTcpEndpoint" closeTimeout="00:01:00" openTimeout="00:01:00"
receiveTimeout="00:10:00" sendTimeout="00:01:00" transactionFlow="false"
transferMode="Buffered" transactionProtocol="OleTransactions"
hostNameComparisonMode="StrongWildcard" listenBacklog="10" maxBufferPoolSize="52428800"
maxBufferSize="65536000" maxConnections="1000" maxReceivedMessageSize="65536000">
<readerQuotas maxDepth="65535000" maxStringContentLength="65535000"
maxArrayLength="65535000" maxBytesPerRead="65535000" maxNameTableCharCount="65535000" />
<reliableSession ordered="true" inactivityTimeout="00:10:00"
enabled="true" />
<security mode="None" />
</binding>
</netTcpBinding>
</bindings>
<client>
<endpoint address="net.tcp://10.0.0.44:8731/" binding="netTcpBinding"
bindingConfiguration="NetTcpEndpoint" contract="Test.ITasksService"
name="NetTcpEndpoint">
<identity>
<userPrincipalName value="SKO\Winston" />
</identity>
</endpoint>
</client>
</system.serviceModel>

客户端调用:
InstanceContext ic = new InstanceContext(new CallbackHandler());
Test.TasksServiceClient client = new TasksServiceClient(ic);
client.DoWork();
client.Close();

我现在希望配置文件中的Client节点中的endpoint address通过代码来实现怎么实现???
...全文
183 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
Chenzhit 2009-10-30
  • 打赏
  • 举报
回复
已经解决!
Qweres 2009-10-27
  • 打赏
  • 举报
回复
帮顶

13,347

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 .NET技术前瞻
社区管理员
  • .NET技术前瞻社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧