On Wed, Sep 9, 2009 at 8:00 PM, Tony OHagan <[email protected]> wrote:
> Thanks Craig. > > > Do I need to explicitly perform the selfHost.Open() ? > > I've since noticed that there is an OpenEagerly() fluent method on > DefaultServiceModel() . A hook in the > WcfServiceExtension.CreateServiceHostWhenHandlerIsValid() opens the service > if OpenEagerly() is configured. This happens during service component > registration via WcfServiceExtension.Kernel_ComponentRegistered(). It > similarly Close()s (or Abort()s) the service > during WcfServiceExtension.Kernel_ComponentUnregistered(). > This is used to bypass dependency management and open the service host even if potential dependencies cannot be satisfied. > > Tony. > > On Wed, Sep 9, 2009 at 10:09 PM, Craig Neuwirt <[email protected]> wrote: > >> If I understand you correctly, the app.config will get consulted, but >> you'll need to assign a DefaultServiceModel to your component so the >> facility knows to create a service host for it >> >> >> On Tue, Sep 8, 2009 at 8:49 PM, Tony OHagan <[email protected]>wrote: >> >>> >>> I'm trying configure a self hosted WCF service in a console app. >>> I want to be able to configure the WCF settings via app.config >>> However, I'd like to be able to register most windsor managed >>> components using fluent api code. >>> >>> I've read related past postings and the WCF Integration test suite. >>> >>> Here's a code snippet that *might* do what I want ... >>> >>> using (var container = new WindsorContainer() >>> .AddFacility<WcfFacility>(f => f.CloseTimeout = >>> TimeSpan.Zero) >>> .Install(Castle.Windsor.Installer.Configuration.FromAppConfig >>> ()) >>> .Register( >>> Component.For<MyComponent>() >>> Component.For<MyRepository>(), >>> Component.For<IMyService>() >>> .ImplementedBy<MyServiceImpl>() >>> .Named("MyService") >>> .ActAs(new DefaultServiceModel() >>> >>> ) >>> ) >>> ) >>> >>> { >>> var selfHost = container.GetService<ServiceHost>(); >>> >>> selfHost.Open(); >>> Console.WriteLine("The service is ready."); >>> Console.WriteLine("Press <ENTER> to terminate service."); >>> Console.WriteLine(); >>> Console.ReadLine(); >>> } >>> >>> Questions: >>> >>> What's not clear is when / if the app.config file is consulted for WCF >>> settings (endpoints/binding etc).\ >>> All examples show the DefaultServiceModel() followed by fluent >>> endpoint binding calls. >>> >>> So will adding >>> .Install >>> (Castle.Windsor.Installer.Configuration.FromAppConfig()) >>> ... configure the self hosted service or will this get picked up some >>> other way (maybe via DefaultServiceModel()) ? >>> >>> Do I need to explicitly perform the selfHost.Open() ? >>> >>> Thanks >>> >>> >>> >>> >>> >> >> >> > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
