I am trying to create 2 wcf services that use the same
IOperationBehavior. Which ever service is created first works fine,
but the 2nd one created bombs out with this error:

The value could not be added to the collection, as the collection
already contains an item of the same type: 'MyOperationBehavior'. This
collection only supports one instance of each type.
Parameter name: item

Here is a little stack trace info:

System.Collections.Generic.KeyedByTypeCollection`1.InsertItem(Int32
index, TItem item) +16301212
 
Castle.Facilities.WcfIntegration.WcfExplicitExtension.Install(ServiceEndpoint
endpoint, Boolean withContract, IKernel kernel, IWcfBurden burden)
+308
 
Castle.Facilities.WcfIntegration.ServiceHostExtensions.Castle.Facilities.WcfIntegration.IWcfExtensionVisitor.VisitEndpointExtension(IWcfEndpointExtension
extension) +217
 
Castle.Facilities.WcfIntegration.ServiceHostExtensions.Install(ICollection`1
extensions, IWcfBurden burden) +110
 
Castle.Facilities.WcfIntegration.AbstractServiceHostBuilder.ConfigureServiceHost(ServiceHost
serviceHost, IWcfServiceModel serviceModel, ComponentModel model) +833
 
Castle.Facilities.WcfIntegration.AbstractServiceHostBuilder`1.Build(ComponentModel
model, M serviceModel, Uri[] baseAddresses) +77
 
Castle.Facilities.WcfIntegration.WcfServiceExtension.CreateServiceHost(IKernel
Kernel, IWcfServiceModel serviceModel, ComponentModel model, Uri[]
baseAddresses) +548
 
Castle.Facilities.WcfIntegration.WindsorServiceHostFactory`1.CreateServiceHost(String
constructorString, Uri[] baseAddresses) +183
   GameF



Here is how I have registered the behavior and services

Component.For<ValidateOperationBehavior>().Attribute("scope").Eq(WcfExtensionScope.Explicit),
Component.For<IAccountRegistrationService>().ImplementedBy<AccountRegistrationService>().ActAs(new
DefaultServiceModel().Hosted().AddExtensions(typeof(ValidateOperationBehavior))),
Component.For<IRetailService>().ImplementedBy<RetailService>().ActAs(new
DefaultServiceModel().Hosted().AddExtensions(typeof(ValidateOperationBehavior)))

Should this behavior work? Is there some other way I should be
registering this behavior?

Thanks for any help or pointers?

Jesse

-- 
You received this message because you are subscribed to the Google Groups 
"Castle Project Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/castle-project-users?hl=en.

Reply via email to