相关疑难解决方法(0)

WCF路由器:单向和请求 - 回复操作

为了准备我的70-513考试,我发现了这个问题:

Windows Communication Foundation(WCF)服务实现具有单向和请求 - 回复操作的合同.该服务通过TCP传输公开.客户端使用路由器与服务进行通信.路由器实现如下.(行号仅供参考.)

01 ServiceHost host = new ServiceHost(typeof(RoutingService));
02 host.AddServiceEndpoint (
03     typeof(ISimplexDatagramRouter),
04     new NetTcpBinding(), "net.tcp://localhost/Router"
05    );
06 List<ServiceEndpoint> lep = new List<ServiceEndpoint>();
07 lep.Add (
08     new ServiceEndpoint (
09         ContractDescription.GetContract(
10             typeof(ISimplexDatagramRouter)
11    ),
12     new NetTcpBinding(),
13     new EndpointAddress("net.tcp://localhost:8080/Logger")
14    )
15 );
16 RoutingConfiguration rc = new RoutingConfiguration();
17 rc.FilterTable.Add(new MatchAllMessageFilter(), lep);
18 host.Description.Behaviors.Add(new RoutingBehavior(rc));
Run Code Online (Sandbox Code Playgroud)

请求 - 回复操作失败.您需要确保路由器可以处理单向和请求 - 回复操作.你该怎么办?

  • .更改第03行如下

    typeof运算((IRequestReplyRouter)

  • .更改第03行如下

    typeof运算((IDuplexSessionRouter)

  • Ç.更改第10行如下

    typeof运算((IRequestReplyRouter)

  • d …

.net wcf router

1
推荐指数
1
解决办法
1798
查看次数

标签 统计

.net ×1

router ×1

wcf ×1