John,
  The ChannelFactory create multiple channels and thus will not be closed
when you release the proxy.  The actual Channel will be closed however.
 Then the component is released or the container is disposed of, the
ChannelFactory will get closed.

craig

On Sun, Aug 9, 2009 at 11:52 PM, John Simons <[email protected]>wrote:

>
> Not sure if I'm using this facility correctly.
>
> I'm using it on the client side.
>
> I have configured my services to be LifeStyle.Transient because my
> endpoint url changes dynamically.
>
> Here is a snip of my global.asax:
>
>        container = new WindsorContainer()
>                        .AddFacility("startable", new StartableFacility())
>                        .AddFacility("mr", new MonoRailFacility())
>                        .AddFacility("loggingfacility", new LoggingFacility
> (LoggerImplementation.Log4net, "Config/logging.config"))
>                        .AddFacility<WcfFacility>(f => f.DefaultBinding =
>                                                       new WSHttpBinding
>                                                           {
>
> BypassProxyOnLocal =
> true,
>
> MaxReceivedMessageSize = 331070,
>
> UseDefaultWebProxy =
> false,
>
>                                                           }
>                        )
>                        .Register(
>                                  Component.For<ChannelFactoryListener>(),
>                                  Component.For<ICore>()
>                                      .LifeStyle.Transient
>                                      .ActAs(new DefaultClientModel()),
>                                  Component.For<IComputerManagement>()
>                                      .LifeStyle.Transient
>                                      .ActAs(new DefaultClientModel()),
>                                  Component.For<IUserManagement>()
>                                      .LifeStyle.Transient
>                                      .ActAs(new DefaultClientModel()),
>                                  Component.For<IPostManagement>()
>                                      .LifeStyle.Transient
>                                      .ActAs(new DefaultClientModel()));
>
> I than use it like this:
> proxy = container.Resolve<ICore>(new { Endpoint = WcfEndpoint.At
> (uri) });
>
> and once I'm done with it I call:
> container.Release(proxy);
>
> I assumed that by calling "container.Release(proxy);" on a Transient
> component the ChannelFactory.Close() would be called, but this doesn't
> seem to be the case. Am I doing something wrong?
> I need the ChannelFactory to be disposed of otherwise all the Channels
> remain open!
>
> BTW, the ChannelFactoryListener is just this:
> public class ChannelFactoryListener : AbstractChannelFactoryAware
> {
>        public override void Created(ChannelFactory channelFactory)
>        {
>            channelFactory.Credentials.Windows.ClientCredential =
> CredentialCache.DefaultNetworkCredentials;
>
> channelFactory.Credentials.Windows.AllowedImpersonationLevel =
> TokenImpersonationLevel.Impersonation;
>        }
> }
>
> Cheers
> John
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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