Proxies / Thread Safety? RRS feed

  • General discussion

  • Are T channels created from ChannelFactory considered to be thread safe?  Are ClientBaseT proxies thread safe?

    The reason I ask is because I see in the Microsoft WIF and Web Farms sample, Microsoft reuses the same client proxy

    for each request as it is scoped to the class instance.

    Link WIF and Web Farms

    See SharedSessionSecurityTokenCache in their sample.

    Is this a safe thing to do in this context?

    Monday, June 24, 2013 5:18 PM

All replies

  • Hi,

    According to MSDN document the type of ChannelFactory<TChannel> is thread safe; any public static (Shared in Visual Basic) members of ClientBase<TChannel> type are thread safe, any instance members are not guaranteed to be thread safe.

    Best Regards.

    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Tuesday, June 25, 2013 7:55 AM
  • Not concerned about ChannelFactory<T> and thread safety.  Concerned about the channel returned by ChannelFactory being thread safe.  I don't think it is but can't find anything official about it not being safe.

    The Microsoft example for WIF and Web Farms is reusing the channel across threads and I don't think it is thread safe.

    Tuesday, June 25, 2013 2:57 PM