Yes, it is possible to configure the WCF routing service and get the WSDL files for a separate service.
Step 1 - Set the HttpGetEnabled set to true and configure the MEX endpoint in all WCF services that are behind the router
<service behaviorConfiguration="routingBehv" name="System.ServiceModel.Routing.RoutingService"> <host> <baseAddresses> <add baseAddress="http://localhost/WcfRoutingService/RoutingService.svc"/> </baseAddresses> </host> <endpoint address="http://localhost/WcfRoutingService/RoutingService.svc" binding="mexHttpBinding" name="mexEndpoint" contract="System.ServiceModel.Routing.IRequestReplyRouter"/> </service>
Step 2 - Configure Routing Service
Add end point
<endpoint address="" binding="mexHttpBinding" name="mexEndpoint" contract="System.ServiceModel.Routing.IRequestReplyRouter"/>
Add Service Behavior
<behaviors> <serviceBehaviors> <behavior> <routing routeOnHeadersOnly="false" filterTableName="routingTable" /> <serviceDebug includeExceptionDetailInFaults="true" /> <serviceMetadata httpGetEnabled="false" /> </behavior> </serviceBehaviors> </behaviors>
The client endpoint address must indicate the "MEX" endpoint address
<client> <endpoint address="http://localhost/PremiumWcfService/PremiumWCFService.svc/mex" binding="mexHttpBinding" contract="*" name="PremiumServiceMex"/> <endpoint address="http://localhost/StandardWCFService/StandardWCFService.svc/mex" binding="mexHttpBinding" contract="*" name="StandardServiceMex"/> </client>
Specify a routing table
<routing> <filters> <filter name="StandardServiceMexFilter" filterType="EndpointAddress" filterData="http://tempuri.org/WcfRoutingService/RoutingService.svc/StandardService" /> <filter name="PremiumServiceMexFilter" filterType="EndpointAddress" filterData="http://tempuri.org/WcfRoutingService/RoutingService.svc/sPreminuService" /> </filters> <filterTables> <filterTable name="routingTable"> <add filterName="StandardServiceMexFilter" endpointName="StandardServiceMex"/> <add filterName="PremiumServiceMexFilter" endpointName="PremiumServiceMex"/> </filterTable> </filterTables> </routing>
You are all done. You can directly access the WSDL file of your services using the individual URLs:
http://localhost/WcfRoutingService/RoutingService.svc/StandardService http://localhost/WcfRoutingService/RoutingService.svc/PremiumService
Mike
source share