(KJ)
11/12/2007 5:57:00 PM
On Nov 10, 11:42 am, "Willy Denoyette [MVP]"
<willy.denoye...@telenet.be> wrote:
> "BillGatesFan" <klj_m...@hotmail.com> wrote in message
>
> news:1194623992.932294.293600@y27g2000pre.googlegroups.com...
>
>
>
>
>
> > On Nov 9, 10:41 am, BillGatesFan <klj_m...@hotmail.com> wrote:
> >> On Nov 8, 6:03 pm, "Willy Denoyette [MVP]"
>
> >> <willy.denoye...@telenet.be> wrote:
> >> > "BillGatesFan" <klj_m...@hotmail.com> wrote in message
>
> >> >news:1194547971.220431.32720@i38g2000prf.googlegroups.com...
>
> >> > > On Nov 8, 12:39 pm, "Willy Denoyette [MVP]"
> >> > > <willy.denoye...@telenet.be> wrote:
> >> > >> "Willy Denoyette [MVP]" <willy.denoye...@telenet.be> wrote in
> >> > >> messagenews:eqnVv3hIIHA.4584@TK2MSFTNGP03.phx.gbl...
>
> >> > >> > "BillGatesFan" <klj_m...@hotmail.com> wrote in message
> >> > >> >news:1194470936.849868.230750@k79g2000hse.googlegroups.com...
> >> > >> >>I have a web service which calls a .NET queued serviced component
> >> > >> >>in
> >> > >> >> COM+. I turned statistics on for the component. I call the
> >> > >> >> component
> >> > >> >> 10 times, 10 objects get created but they do not go away. I'm
> >> > >> >> calling
> >> > >> >> Marshal.ReleaseComObject after I make each call.
>
> >> > >> >> [WebMethod]
> >> > >> >> public NotifyResponse Notify(NotifyRequest reqMessage)
> >> > >> >> {
> >> > >> >> try
> >> > >> >> {
> >> > >> >> string progid = "MyComponent";
> >> > >> >> MyComponent=
> >> > >> >> (IMyComponent)Marshal.BindToMoniker("queue:/new:" + progid);
> >> > >> >> if ( MyComponent != null)
> >> > >> >> {
> >> > >> >> MyComponent.Notify(XMLMessage);
> >> > >> >> }
> >> > >> >> return resMessage;
> >> > >> >> }
> >> > >> >> catch (Exception e)
> >> > >> >> {
> >> > >> >> ErrorLog.Log(Severity.Error, "An exception was
> >> > >> >> thrown:" + e.Message);
> >> > >> >> return resMessage;
> >> > >> >> }
> >> > >> >> finally
> >> > >> >> {
> >> > >> >> Marshal.ReleaseComObject(MyComponent);
> >> > >> >> }
> >> > >> >> }
>
> >> > >> > Your class derives from an IDisposable (ServicedComponent) so you
> >> > >> > have
> >> > >> > to
> >> > >> > "dispose" when done, that is, you need to call MyComponent
> >> > >> > .Dispose()
> >> > >> > or
> >> > >> > use the using idiom.
>
> >> > >> > using (Mycomponent = ...)
> >> > >> > {
> >> > >> > // use the component...
>
> >> > >> > } //this implicitly calls Dispose
>
> >> > >> > Willy.
>
> >> > >> Sorry, I missed the Moniker, you effectively get a COM wrapper back,
> >> > >> so
> >> > >> you
> >> > >> need to call ReleaseComObject.
> >> > >> Need to investigate this a bit, i'll come back when done.
>
> >> > >> Willy.- Hide quoted text -
>
> >> > >> - Show quoted text -
>
> >> > > Thanks so much! I'll be wainting
>
> >> > Note that what is shown here are the instances of the queued components
> >> > created by MSMQ, your client is talking to MSMQ NOT to the COM+ Server,
> >> > that
> >> > is the interface you got from the moniker points to the MSMQ service,
> >> > Marshal.ReleaseComObject correctly releases the instance with the MSMQ
> >> > server.
> >> > Did some tests myself using an hosted *queued* (non pooled) component
> >> > service (COM+ Server component), and I think that the info showed in
> >> > the
> >> > Component services applet cannot be trusted, in the tests I ran I see
> >> > the
> >> > Object count varying between something like 10 and 80, this value drops
> >> > when
> >> > there are no messages sent to the queue, but they never return to a
> >> > value
> >> > lower than 10. This value remains even when MSMQ is shut-down which
> >> > should
> >> > definitely release the interface with the COM+ Server.
>
> >> > Willy.- Hide quoted text -
>
> >> > - Show quoted text -
>
> >> Alright. Thanks for your help. Do you think this will have any affect
> >> on the performance of the component? My only concern now is that this
> >> left over number seems to grow over time. Every time I send more
> >> messages to the queue, the left over number grows. Did you notice that?-
> >> Hide quoted text -
>
> >> - Show quoted text -
>
> > Also I was wondering if I check the checkbox "Automatically deactivate
> > this object when this method returns" for the main method of the
> > queued component? Will this make any difference? Thanks
>
> This can be accomplished by marking the Method as AutoComplete.
>
> [AutoComplete(true)]
> public void Foo()..
>
> But this won't change that much as far as the statistics are concerned ,
> except that you might see a larger # of Objects count and that the Activated
> count returns to 0 when done with the last object and the queue is empty.
> As I told you before the "statistics" are a feature used to illustrate a
> component's activity, what you get is just a snap-shot of the component
> states at a fixed interval, they do not reflect any real-time information.
>
> Willy.- Hide quoted text -
>
> - Show quoted text -
Thanks for all your help.