我在使用.Net 4.0路由服务连接到使用回调的服务时遇到问题。据我所知,路由服务支持绑定和回调。仅服务和客户端运营良好。
我做了什么,是在这里找到MS WCF和WF样本:http://www.microsoft.com/downloads/en/details.aspx?FamilyID=35ec8682-d5fd-4bc3-a51a-d8ad115a8792&displaylang=en
并更改配置以匹配我的服务绑定。我可以通过路由服务从客户端调用操作到服务,客户端不会收到从服务到客户端的回调。
使用控制台应用程序作为主机
,配置路由服务如下using (ServiceHost serviceHost =
new ServiceHost(typeof(RoutingService)))
{
serviceHost.Open();
Console.ReadLine();
}
<system.serviceModel>
<diagnostics>
<messageLogging logMalformedMessages="true" logMessagesAtServiceLevel="true"
logMessagesAtTransportLevel="true" />
</diagnostics>
<services>
<!--ROUTING SERVICE -->
<service behaviorConfiguration="routingData" name="System.ServiceModel.Routing.RoutingService" >
<host>
<baseAddresses>
<add baseAddress="http://localhost:8000/routingservice/router"/>
</baseAddresses>
</host>
<endpoint address=""
binding="wsDualHttpBinding"
name="reqReplyEndpoint"
contract="System.ServiceModel.Routing.IRequestReplyRouter"
bindingConfiguration="UnSecureBinding"/>
<endpoint address="mex"
binding="mexHttpBinding"
contract="IMetadataExchange" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="routingData">
<serviceMetadata httpGetEnabled="True"/>
<serviceDebug includeExceptionDetailInFaults="true" />
<routing filterTableName="routingTable1" />
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<wsDualHttpBinding>
<binding name="UnSecureBinding">
<security mode="None" />
</binding>
</wsDualHttpBinding>
</bindings>
<client>
<endpoint name="NotificationService"
address="http://localhost/CommServices/NotificationService.svc"
binding="wsDualHttpBinding"
bindingConfiguration="UnSecureBinding"
contract="*" />
</client>
<!--ROUTING SECTION -->
<routing>
<filters>
<filter name="MatchAllFilter1" filterType="MatchAll" />
</filters>
<filterTables>
<filterTable name="routingTable1">
<add filterName="MatchAllFilter1" endpointName="NotificationService" />
</filterTable>
</filterTables>
如果我启用ServiceModel跟踪,我可以在WCF堆栈深处看到一个ArgumentException,到目前为止跟踪了一条跟踪。
任何人都可以提示正确的方向,或者纠正我如果我对RoutingService的回调功能的假设是错误的。
TIA&amp;干杯 多米尼克
答案 0 :(得分:3)
如果有人像我一样绊倒,问题是路由器端点上的合同。 RequestReplyRouter不支持回调,但IDuplexSessionRouter支持回调。
<endpoint address=""
binding="wsDualHttpBinding"
name="reqReplyEndpoint"
contract="System.ServiceModel.Routing.IDuplexSessionRouter"
bindingConfiguration="UnSecureBinding"/>
此致 多米尼克