【问题标题】:WCF 4 routing service throws handler errorWCF 4 路由服务引发处理程序错误
【发布时间】:2014-09-22 14:46:19
【问题描述】:

我正在尝试以声明方式使用 WCF 4 路由将我的 (REST) Web 服务的一个分支重定向到备用服务器。我将 WCF 的 System.ServiceModel.Routing.RoutingService 配置为将 http://oldserver:81/FileService/ 调用路由到 http://newserver:82/FileService/,但是当我尝试访问重定向的服务时,它所做的只是抛出错误

Handler "HttpLogging" has a bad module "HttpLoggingModule" in its module list

我可以在浏览器中输入新服务的 URL,它们工作正常,但旧服务的 URL(要重新路由)失败。

我已将以下路由配置添加到我的 Web 服务应用程序中:

<configuration>
    <system.serviceModel>
        <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
        <behaviors>
            <serviceBehaviors>
                <behavior name="routingConfig">
                    <!-- Specify the routing table to use. -->
                    <routing filterTableName="routingTable1" />
                    <serviceDebug includeExceptionDetailInFaults="true" />
                    <serviceMetadata httpGetEnabled="true" />
                </behavior>
            </serviceBehaviors>
        <!-- WCF routing table -->
        <routing>
            <filters>
                <filter name="FileFilter1" filterType="EndpointName" filterData="FileService"/>
            </filters>
            <filterTables>
                <filterTable name="routingTable1">
                    <add filterName="FileFilter1" endpointName="FileService" />
                </filterTable>
            </filterTables>
        </routing>
        <client>
            <!-- Destination endpoint defining the base URL where File messages will be routed. -->
            <endpoint name="FileService"
                      address="http://newserver:82/FileService/"
                      binding="webHttpBinding"
                      contract="*" />
        </client>
        <services>
            <!-- WCF routing service. -->
            <service name="System.ServiceModel.Routing.RoutingService" behaviorConfiguration="routingConfig" >
                <host>
                    <baseAddresses>
                        <!-- The service endpoint to be redirected. -->
                        <add baseAddress="http://oldserver:81/FileService" />
                    </baseAddresses>
                </host>
                <!-- Define the endpoints of the service to receive messages. -->
                <endpoint name="reqReplyEndpoint" binding="webHttpBinding" contract="System.ServiceModel.Routing.IRequestReplyRouter" address="" />
            </service>
        </services>

应用程序中不再有 FileService 服务,除了应该由路由服务公开的服务。

我试过了:

  • MatchAll、EndpointAddress 和 PrefixEndpointAddress 的过滤类型;
  • 各种形式的旧服务地址;
  • 过滤器、路由表、服务的不同名称;
  • 重命名合同。

这些都没有让我的客户调用重定向的服务,更不用说任何表明路由服务可操作甚至完全配置的迹象。

如何使路由真正起作用?如果做不到这一点,我将如何调试它以便确定要修复的内容?

【问题讨论】:

    标签: web-services wcf rest routing


    【解决方案1】:

    我看到的一般问题是您正在尝试使用不受支持的路由服务来路由 REST 调用。 MSDN 参考:

    https://msdn.microsoft.com/en-us/library/ee517423.aspx

    路由服务当前不支持 WCF REST 的路由 服务。要路由 REST 调用,请考虑使用 System.Web.Routing 或 应用请求路由 (http://go.microsoft.com/fwlink/?LinkId=164589)。 块引用

    【讨论】:

      猜你喜欢
      • 2013-07-18
      • 2011-05-29
      • 1970-01-01
      • 2011-07-16
      • 1970-01-01
      • 2014-02-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多