Castle Windsor WCF Facility主机仅基于WCF服务接口?

时间:2010-02-01 15:06:13

标签: .net wcf castle-windsor

我有运行时提供的WCF服务接口:

    [ServiceContract]
    public interface IHelloService {
        [OperationContract]
        string SayHello(string message);
    }

我想用我的Windsor容器(每个提供的服务界面一次):

container.Register(Component
    .For(typeof(IHelloService))
    .Interceptors(typeof(HelloServiceInterceptor)).First
    .ActAs(new DefaultServiceModel()
        .AddEndpoints(WcfEndpoint
            .BoundTo(new BasicHttpBinding())
            .At("http://localhost:6080/HelloService/")
        )
    )
);

如您所见,不会提供任何实施。

拦截器:

    class HelloServiceInterceptor: Castle.Core.Interceptor.IInterceptor {
        public void Intercept(Castle.Core.Interceptor.IInvocation invocation)
        {
            // Do what I must to answer the call
        }
    }

Windsor WCF Facility“可以”“是这样吗?” 有没有办法通过Windsor WCF Facility“按原样”实现这一目标? 也许我可以提供所提供服务接口的虚拟实现,你会怎么做?

请不要问为什么;)

如果我在其他地方得到答案,我会告诉你。

0 个答案:

没有答案