Cast to IDisposable and do it yourself.Note the WCF disposable pitfall, mind
you

On Wed, Nov 5, 2008 at 7:38 PM, Callum Hibbert <[EMAIL PROTECTED]>wrote:

> Craig - I think it was you who did some (most? all?) of the work on the WCF
> integration, are you saying the client shouldn't be transient (in most
> cases)?
>
> Oren - I only have a reference to "IMyWcfService" which does not implement
> IDisposable. This is the same interface as the server-side service and it is
> my understanding that this should not implement IDisposable. So how can I
> close the service? I thought Castle would clean this up for me. Please
> advise if otherwise. I can't dispose the COM component myself, I have to
> trust the 3rd party application does this as it is that which instantiates
> my plugin (no source code for that).
>
> Germán - I am working from the trunk but I have not encountered this issue
> before and I use this Facility alot.
>
> Thanks,
>
> Callum
>
>
> On Wed, Nov 5, 2008 at 5:28 PM, Germán Schuager <[EMAIL PROTECTED]>wrote:
>
>> Are you running from the trunk?
>> Apparently a bug was introduced that makes the container hold references
>> to transient components, thus preventing correct disposal.
>>
>> http://support.castleproject.org/projects/IOC/issues/view/IOC-ISSUE-132
>>
>>  On Wed, Nov 5, 2008 at 2:10 PM, Callum Hibbert <[EMAIL PROTECTED]
>> > wrote:
>>
>>> Hello,
>>>
>>> I am using a third party product for which I have written a plugin. My
>>> plugin is executed using COM, so I have something like this (very simple
>>> example):
>>>
>>>     [Guid("my-guid")]
>>>     [ClassInterface(ClassInterfaceType.None)]
>>>     [ProgId("myProgId")]
>>>     [ComVisible(true)]
>>>     public class MyPlugin : ICustomActivity
>>>     {
>>>         private readonly IMyWcfService service;
>>>
>>>         public MyPlugin()
>>>         {
>>>                 service = Container.Resolve<IMyWcfService>();
>>>         }
>>>
>>>         public string Execute(string xml) // This is the ICustomActivity
>>> implementation
>>>         {
>>>                 string response = service.DoSomething();
>>>                 return message;
>>>         }
>>>     }
>>>
>>> "Container" is a very simple wrapper around WindsorContainer. I am using
>>> the WCF Integration facility so the "service" object is a WCF service
>>> proxy/client. I have marked the object as transient, for example:
>>>
>>> <castle>
>>>     <components>
>>>         <component
>>>             id="IMyWcfService"
>>>             type="Company.Product.IMyWcfService, Company.Product"
>>>             wcfEndpointConfiguration="MyWcfServiceClientEndpointConfig"
>>>             lifestyle="transient" />
>>>     </components>
>>> </castle>
>>>
>>> My problem is that the "service" client is not being closed. If I run my
>>> application under load, I hit the maximum 10 open connections and then start
>>> to get errors for subsequent connections. I am unwilling to configure an
>>> increase in the number of allowed connections because this would be hiding
>>> the underlying problem.
>>>
>>> I have used Castle's WCF Integration on a lot of projects before and I
>>> have not experienced this problem, though this is the first time COM has ben
>>> thrown into the mix.
>>>
>>> Obviously, I have no hook to IDisposable. IMyWcfService does not
>>> implement IDisposable (and imy understanding is that you should never do
>>> that). Also, I cannot cast the proxy to IDisposable as a work around.
>>>
>>> Can anyone shed any light on what the problem might be? Is this something
>>> to do with the fact that the plugin is called via COM and is not disposed of
>>> correctly? How can I ensure the client is closed and disposed properly (and
>>> in a timely manner)?
>>>
>>> Any help or pointers greatly appreciated.
>>>
>>> Thanks,
>>>
>>> Callum
>>>
>>>
>>>
>>   >>
>>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Castle Project Users" group.
To post to this group, send email to castle-project-users@googlegroups.com
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