Dispose MUST be called from the client and not from the serviced component…
There is a requirement for clients of COM+ Serviced Components to call dispose on the component. If you do not do this, it will not shut down. When you inherit from servicedcomponent, you also inherit from IDisposable. However, the client MUST call the dispose method explicitly to properly clean up the object instance.
FIX: A COM+ application that uses the global interface table (GIT) may deadlock
FIX: Slow performance, deadlocks, and memory leaks may occur when applications do not call the Dispose method on all instances of the ServicedComponent class in the .NET Framework
In unmanaged C++:
In C++ get the IDispatch pointer and call this…
. . .
hr = DoDispose(objDispatch);
. . .
HRESULT DoDispose(IDispatch* objDispatch)
HRESULT hr = S_OK;
unsigned int iError = 0;
params.cArgs = 0;
params.cNamedArgs = 0;
params.rgdispidNamedArgs = NULL;
OLECHAR* name = L”Dispose”;
HRESULT dispHR = objDispatch->GetIDsOfNames
// Make the call to the “Dispose” method
hr = objDispatch->Invoke(dispid,
In C#/managed code:
Here is a sample of what C# would do for the call. In this case DoStuff will do an Exchange Powershell call (implementation not shown):
MyServicedCOM.MyServicedCOMponent abc = new MyServicedCOM.MyServicedCOMponent();
iRet = abc.DoStuff(sServerName, sSGName);
IDisposable idsp = abc as IDisposable;
To check for shut-down:
One other thing that should help to illuminate it: In Component Services, find your
application, and expand all the way down to the components folder. Find this component and
right click, choose properties. On the activation tab, check the “Component supports events and
Close properties, then select the components folder for you application. Right click on the folder and change the view to “Status”. This will show you if the object is running and when/if it shuts down.
For further information on PowerShell, please visit the link below: —————————————————————————— Links on Common PowerShell Automation Questions
For further information on PowerShell, please visit the link below:
Links on Common PowerShell Automation Questions