In such scenario you do not need to use .AsWcfService() at all. Registering the service as an ordinary component in Windsor and setting the factory to "Castle.Facilities.WcfIntegration.DefaultServiceHostFactory, Castle.Facilities.WcfIntegration" in <serviceActivations> or .svc file is enough. The service will use settings specified in web.config.
An example is shown here: http://iamnotmyself.com/2011/06/20/using-castle-wcf-facility-for-ridiculously-simple-services/ One caveat with supporting multiple protocols is the issue of application initialization. Global.asax works for http activation only; Windsor documentation ( http://docs.castleproject.org/Windsor.WCF-Facility-Registration.ashx) suggests using the App_Initialize method. As I dislike deploying uncompiled source code, I use the following solution: - create a class derived from Castle.Facilities.WcfIntegration.DefaultServiceHostFactory, - in the constructor, initialize the application (create WindsorContainer etc.), using e.g. System.Threading.LazyInitializer to ensure the initialization is performed only once, and pass container.Kernel to base constructor, - set this class as the factory for all services. The first request on any endpoint, regardless of protocol, will now trigger the initialization of the application. On Wednesday, December 18, 2013 12:15:22 AM UTC+1, Scott_M wrote: > Can WCF Facility be used to register a WCF service (IIS hosted) with > multiple bindings where the bindings are specified in web.config and not in > code? > > > Have a service that need to expose over http and net.tcp bindings but > would like for binding info to be in web.config and not in installer if > possible. here is what I have so far but not sure if this is correct: > > //Register our one and only wcf service > container.AddFacility<WcfFacility>(); > container.Register( > Component.For<IFooService>() > .ImplementedBy<FooService>() > .LifestyleTransient() > .Named("FooService") //Component name must jive > with service name in web.config / serviceactivations > .AsWcfService(new > DefaultServiceModel().Hosted())); > > > > -- You received this message because you are subscribed to the Google Groups "Castle Project Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/castle-project-users. For more options, visit https://groups.google.com/groups/opt_out.
