【问题标题】:what are the default service behaviors on ServiceModel.Routing?ServiceModel.Routing 的默认服务行为是什么?
【发布时间】:2015-01-06 05:10:44
【问题描述】:

ServiceModel.Routing 上的默认服务行为是什么?

我不是在谈论 Azure 的东西,我指的是来自

的这些接口

System.ServiceModel.Routing

  • IDuplexSessionRouter
  • IRequestReplyRouter
  • ISimplexDatagramRouter
  • ISimplexSessionRouter

我了解在工作的实际服务端点为所需上下文选择正确的“绑定”,....

(即这个路由器(hand-rolled-service_bus)实际上要将 (通过 EndPointName) 消息路由到的服务)

(当然,将来会有几个服务根据调用者提供的 ---EndPointName--- 路由到各种服务)

...但是在实现一个或多个 System.ServiceModel.Routing 命名空间接口的中间层路由服务,这些路由“合同”如何处理并发和实例模式?!

我是否过度思考这些路由合同(接口)只是传递消息?当我输入这个时,我想知道我是否应该真正创建一个继承所需路由接口/合同的类,并尝试手动应用我所需的服务行为,就像 normal WCF 接口...

所有示例都只是“使用”这些路由接口,而不是创建实现其中一个的类并在其后附加服务行为。

【问题讨论】:

    标签: c# wcf wcf-routing


    【解决方案1】:

    “路由服务”只是根据路由表将消息传递给目标服务。

    根据System.ServiceModel.Routing.dll, v4.0.0.0 程序集,接口定义为 InstanceContextMode = InstanceContextMode.PerSession 定义如下:

    namespace System.ServiceModel.Routing
    {
        // Summary:
        //     Defines the routing service, which is responsible for routing messages between
        //     endpoints based on filter criteria.
        [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
        [ServiceBehavior(AddressFilterMode = AddressFilterMode.Any, InstanceContextMode = InstanceContextMode.PerSession, UseSynchronizationContext = false, ValidateMustUnderstand = false)]
        public sealed class RoutingService : ISimplexDatagramRouter, ISimplexSessionRouter, IRequestReplyRouter, IDuplexSessionRouter, IDisposable
        {
        }
    }
    

    【讨论】:

      猜你喜欢
      • 2012-06-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-11-04
      • 2020-10-27
      • 2017-08-20
      相关资源
      最近更新 更多