是否有可能在WCF 4中为REST基础服务使用新的WCF路由服务?我有一些类似于逆向代理的想法。基本上我有一些selfhosted rest基于serivces,我想通过IIS公开与相同的基础URL和端口。路由应该由url的最后部分完成。我是WCF路由服务的绝对新手,所以如果这是一个愚蠢的问题,请原谅我,但我在网上找不到任何有关此信息的信息。.net 4 WCF路由服务+ REST
我已经试过这样的事情(其中serivce1/2是selfhosted服务):
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="RoutingBehavior">
<routing routeOnHeadersOnly="false" filterTableName="RoutingTable"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
<serviceMetadata httpGetEnabled="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service behaviorConfiguration="RoutingBehavior" name="System.ServiceModel.Routing.RoutingService">
<endpoint address="myservices" contract="System.ServiceModel.Routing.IRequestReplyRouter" binding="basicHttpBinding"/>
</service>
</services>
<routing>
<filterTables>
<filterTable name="RoutingTable">
<add filterName="service1Filter" priority="0" endpointName="service1"/>
<add filterName="service2Filter" priority="0" endpointName="service2"/>
</filterTable>
</filterTables>
<filters>
<filter name="service1Filter" filterType="MatchAll"/>
<filter name="service2Filter" filterType="MatchAll"/>
</filters>
</routing>
<client>
<endpoint address="http://somehost:8888/test/service1" binding="basicHttpBinding" contract="*" name="service1"/>
<endpoint address="http://somehost:8732/test/service2" binding="basicHttpBinding" contract="*" name="service2"/>
</client>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true"/>
</system.serviceModel>
,但似乎并没有工作。我收到一个没有发现异常的端点。 http://somehost:8888/test/service1是自托管服务的基地址,而不是实际的端点。我可以根据基地址进行路由吗(如果可以休息路由),我是否必须为每个端点添加路由?
我认为这可能会错过WCF路由服务。我将使用像ARR这样的“真正”反向代理。 – Jeldrik 2010-07-26 15:41:51