我现在有一个服务部署在不通的端口上,在实现其通过WCF路由来交替调用时,出现了问题,只能调用的一个服务;请大家帮忙看看,配置文件如下:
路由端配置:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<services>
<service name="System.ServiceModel.Routing.RoutingService" behaviorConfiguration="RoutingBehaviors">
<endpoint name="nDB2" address="DB2" binding="netTcpBinding" contract="System.ServiceModel.Routing.IRequestReplyRouter" />
<!--使用的是EndpointName-->
<endpoint name="nDB1" address="DB1" binding="netTcpBinding" contract="System.ServiceModel.Routing.IRequestReplyRouter" />
<host>
<baseAddresses>
<add baseAddress="net.tcp://localhost:9002/V1/Routing"/>
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="RoutingBehaviors">
<serviceDebug includeExceptionDetailInFaults="true"/>
<routing filterTableName="FilterTable1"/>
</behavior>
</serviceBehaviors>
</behaviors>
<routing>
<filters>
<filter name="FilterTest" filterType="EndpointName" filterData="nDB1" />
</filters>
<filterTables>
<filterTable name="FilterTable1">
<!--backupList :备份-->
<add endpointName="TestEndpoint" filterName="FilterTest" priority="1" backupList=""/>
<add endpointName="BackupServerA" filterName="FilterTest" priority="2" backupList=""/>
</filterTable>
</filterTables>
<backupLists>
<backupList name="backupA">
<add endpointName="BackupServerA" />
</backupList>
</backupLists>
</routing>
<client>
<endpoint address="net.tcp://localhost:8001/ServiceHost" binding="netTcpBinding" contract="*" name="TestEndpoint"/>
<endpoint address="net.tcp://localhost:8002/ServiceHost" binding="netTcpBinding" contract="*" name="BackupServerA"/>
</client>
</system.serviceModel>
</configuration>
客户端配置:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.serviceModel>
<client>
<endpoint address="net.tcp://localhost:9002/V1/Routing/DB2" binding="netTcpBinding"
contract="IDuplexSessionRouter"
name="DuplexSessionRouter" />
<endpoint address="net.tcp://localhost:9002/V1/Routing/DB1" binding="netTcpBinding"
contract="ServiceHost.ITest"
name="DB1" />
</client>
</system.serviceModel>
</configuration>
你的问题太复杂,估计没人回答你。
实现其通过WCF路由来交替调用
是通过程序来控制的吗?
配置的方式可以实现吗?
@Love-逍遥: 你说的 “出现了问题,只能调用的一个服务”, 你有多个服务,就需要单独的建立多个service配置节点。