使用WCF工具添加操作行为

使用WCF工具添加操作行为,wcf,castle-windsor,wcffacility,Wcf,Castle Windsor,Wcffacility,我第一次使用WCF设施来主持一对夫妇 服务,包括控制台应用程序(便于调试)和IIS(用于 生产)。这些服务使用net.msmq端点 这是我在控制台应用程序中托管服务的方式(简化): 下面是它的注册方式: container.Register(Component.For<UserRequestService>() .LifestylePerWcfOperation()) 以下是我尝试过的: container.Register

我第一次使用WCF设施来主持一对夫妇 服务,包括控制台应用程序(便于调试)和IIS(用于 生产)。这些服务使用net.msmq端点

这是我在控制台应用程序中托管服务的方式(简化):

下面是它的注册方式:

container.Register(Component.For<UserRequestService>()
                            .LifestylePerWcfOperation()) 
以下是我尝试过的:

container.Register(Component.For<IOperationBehavior>() 
                            .UsingFactoryMethod(
                                x => new OperationBehaviorAttribute 
                                { 
                                    TransactionScopeRequired = true, 
                                    TransactionAutoComplete = true 
                                })); 
有什么想法吗

[OperationBehavior(TransactionScopeRequired = true,
                   TransactionAutoComplete = true)] 
container.Register(Component.For<IOperationBehavior>() 
                            .UsingFactoryMethod(
                                x => new OperationBehaviorAttribute 
                                { 
                                    TransactionScopeRequired = true, 
                                    TransactionAutoComplete = true 
                                })); 
System.ArgumentException: The value could not be added to the collection, as the collection already contains an item of the same type: 'System.ServiceModel.OperationBehaviorAttribute'. This collection only supports one instance of each type.
Parameter name: item
   at System.Collections.Generic.KeyedByTypeCollection`1.InsertItem(Int32 index, TItem item)
   at Castle.Facilities.WcfIntegration.Internal.WcfUtils.AddBehaviors[T](IKernel kernel, WcfExtensionScope scope, KeyedByTypeCollection`1 behaviors, IWcfBurden burden, Predicate`1 predicate)
   at Castle.Facilities.WcfIntegration.WcfEndpointExtensions.Install(ServiceEndpoint endpoint, Boolean withContract, IKernel kernel, IWcfBurden burden)
   at Castle.Facilities.WcfIntegration.ServiceHostExtensions.Castle.Facilities.WcfIntegration.IWcfExtensionVisitor.VisitEndpointExtension(IWcfEndpointExtension extension)
   at Castle.Facilities.WcfIntegration.ServiceHostExtensions.Install(ICollection`1 extensions, IWcfBurden burden)
   at Castle.Facilities.WcfIntegration.AbstractServiceHostBuilder.ConfigureServiceHost(ServiceHost serviceHost, IWcfServiceModel serviceModel, ComponentModel model)
   at Castle.Facilities.WcfIntegration.AbstractServiceHostBuilder`1.Build(ComponentModel model, Uri[] baseAddresses)
   at Castle.Facilities.WcfIntegration.WindsorServiceHostFactory`1.CreateServiceHost(String constructorString, Uri[] baseAddresses)
   at Program.Main()