Craig, this work as expected. Thank you very much for your insight. One last question, how do I apply the IContractBehavior to apply to a service through the container and not all wcf services?
Thanks again, Jesse On Jan 21, 9:28 am, Craig Neuwirt <[email protected]> wrote: > Jesse, > > You just need to create an IContractBehavior (probably implementing > IErrorHandler too) and add the FaultDescriptions there. > You can then just add the behavior to the container and it will attach it > automatically. > > On Jan 21, 2011, at 11:12 AM, Jesse wrote: > > > Thanks for the feedback Craig, I was thinking that might be the > > problem. Maybe I am going the wrong direction then, my main reason for > > creating a custom host is to add a fault to every operation by > > overriding CreateDescription of DefaultServiceHost. > > Here is the sample code > > > protected override ServiceDescription > > CreateDescription(out IDictionary<string, ContractDescription> > > implementedContracts) { > > > var serviceDescription = base.CreateDescription(out > > implementedContracts); > > > Type validationFaultType = typeof(ValidationFault); > > > foreach (var endpoint in serviceDescription.Endpoints) { > > foreach (var operation in > > endpoint.Contract.Operations) { > > > var validationFaultDescription = new > > FaultDescription(operation.Name){ > > Name = validationFaultType.Name, > > Namespace = > > validationFaultType.Namespace, > > DetailType = validationFaultType > > }; > > > > operation.Faults.Add(validationFaultDescription); > > } > > } > > > return serviceDescription; > > } > > > Do you have thoughts for another implementation that will not require > > me to create my own host, or should I just create an implemenataion of > > IWcfServiceModel and use my own ServiceHostBuilder? > > > Thank you very much for you insight. > > > Jesse > > > On Jan 21, 4:36 am, Craig Neuwirt <[email protected]> wrote: > >> Usually, a new ServiceHostBuilder uses a corresponding IWcfServiceModel. > >> It seams that in your example, you are adding another builder for the > >> DefaultServiceModel. Since one already exists, that is the one being used. > > >> On Jan 20, 2011, at 7:10 PM, Jesse wrote: > > >>> I need to create a custom ServiceHost but still keep benefitting from > >>> the WCF Facility. My ServiceHost extends DefaultServiceHost and I > >>> thought I could create this by implemenentingIServiceHostBuilder. I > >>> register the service host builder like so > > >>> Component.For<IServiceHostBuilder<DefaultServiceModel>>().ImplementedBy<Ret > >>> ailServiceHostBuilder>(), > > >>> but my customIServiceHostBuildernever gets called and the > >>> DefaultServiceHostBuilder from the WCF Facility still is the one > >>> creating the Host. How can I get my customIServiceHostBuilderto run? > >>> Or is there a better way to create my own ServiceHost? > > >>> Thanks, > >>> 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 > >>> athttp://groups.google.com/group/castle-project-users?hl=en.-Hide quoted > >>> text - > > >> - Show quoted text - > > > -- > > 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 > > athttp://groups.google.com/group/castle-project-users?hl=en. -- 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.
