I am using a servicedcomponant class :


public class myClass : System.EnterpriseServices.ServicedComponent, ImyClass



I specify the component run in a system process (I need only one instance for several clients) :

[assembly: ApplicationActivation(ActivationOption.Server)]


- When I use the component (with C# application or Delphi application) it is installed in Administrative Tools --> Component Services --> My Computer --> Com+ but is never stop or removed when my applications stop.

So when I want to modify and built again ma class, I fist have to remove the component in Administrative Tools --> Component Services --> My Computer --> COM+

What can I do to stop or remove the service automaticly when no application use it

Thanks for help or any good idea !!

Re: Transactions Programming Com+ ServicedComponent : Service always running

Florin Lazar - MSFT

Please use PostID=1112987&SiteID=1 as a guide for where to post questions not related to transactions. Thanks.

Re: Transactions Programming Com+ ServicedComponent : Service always running

Jim Carley

When you configure the class to run in a server process, the COM+ runtime will create your component inside a dllhost.exe process.

Server applications in COM+ have a property that defines how long they should remain running while idle, where idle is defined as "there are no component objects currently instantiated".

By default, I believe server applications will remain running for 3 minutes while idle before they are shutdown by the COM+ runtime.

This can be modified by going into Component Services, navigating to the application under Computers->My Computer->COM+ Applications->the application name. Right click on the application name and select "Properties". Under the "Advanced" tab, there is a section titled "Server Process Shutdown", with two radio buttons. One says "Leave running when idle" and the other says "Enable idle shutdown" with a text box containing the number of minutes the process should remain idle before being shutdown. You can modify the number of minutes to a smaller number. I honestly don't know if a value of 0 is allowed.

You can manually shutdown the server application by right-clicking on the application name and selecting "Shutdown". But you should be sure the components aren't being used by any application or the application(s) will encounter an error.

The reason COM+ leaves an idle server application running for some period is because process startup is expensive. The theory is that these server applications will be used over and over again. To avoid having to restart the process after short idle periods, there is this idle shutdown timeout value.