城堡WcfFacility - 服务行为

Ebe*_*oux 4 wcf castle-windsor facilities

如何使用Castle WcfFacility并使用标准的Wcf配置文件设置?

如果我这样注册:

container.Register(
AllTypes.Pick()
    .FromAssemblyNamed("{ServicesAssembly}") // <-- service assembly here
    .If(type => type.Name.EndsWith("Service"))
    .WithService.FirstInterface()
    .Configure(configurer => configurer.LifeStyle.Transient)
    .Configure(configurer => configurer.Named(configurer.Implementation.Name))
    .Configure(configurer => configurer.ActAs(new DefaultServiceModel()))
);
Run Code Online (Sandbox Code Playgroud)

我收到以下错误:

服务"{name}"没有应用程序(非基础结构)端点.

如果我离开:

.Configure(configurer => configurer.ActAs(new DefaultServiceModel()))
Run Code Online (Sandbox Code Playgroud)

好像配置中的行为被忽略了.

这里的正确用法是什么?

Ebe*_*oux 6

好吧,想通了:)

我这样注册:

container.Register(
AllTypes.Pick()
    .FromAssemblyNamed("{ServicesAssembly}") // <-- service assembly here
    .If(type => type.Name.EndsWith("Service"))
    .WithService.FirstInterface()
    .Configure(configurer => configurer.LifeStyle.Transient)
    .Configure(configurer => configurer.Named(configurer.Implementation.Name))
    .Configure(configurer => configurer.ActAs(new DefaultServiceModel().Hosted()))
);
Run Code Online (Sandbox Code Playgroud)

托管()是否有指示,我托管服务; 其他似乎WCF工具将尝试托管它们,导致端口冲突.

所以问题是,在配置文件中的服务是实施的全部类型名称.如果没有人收到错误,说明没有定义端点的内容.因此,服务名称是一样的温莎指定的名称.