Hi All,
I have written a serviced componet and added to the com+..
When i call a function of this component the "Activated" count in the MMC
increases and comes down as expected but if there is an error in the
function call this object never gets deactivated. How do i make sure that
the object gets deactivated even if there is an error..
I am using windows 2003 server and dotnet framework 1.1
I am putting down the dotnet dll code structure. Please advise on how to get
this resolved...
Thanks in advance,
Praveen
using System;
using System.Runtime.InteropServices;
using Orchestra;
using System.EnterpriseServices;
using System.Threading;
namespace OrchFileServer
{
[InterfaceTypeAttribute( ComInterfaceType.InterfaceIsDual )]
[GuidAttribute("C190BFE1-54FC-471B-A7C4-9B6243297D47")]
public interface IFileTransfer
{
void UploadFile(string strURL, string strFilePath);
}
[ EventTrackingEnabled( true ) ]
[ ObjectPooling( MinPoolSize = 10, MaxPoolSize = 100, CreationTimeout =
60000 ) ]
/// Specify COM+ Context Attributes
[ MustRunInClientContext( false ) ]
/// Enable JITA for the component
[ JustInTimeActivation( true ) ]
/// Enable Construction String Support for the component
[ ConstructionEnabled( Enabled=true, Default="" ) ]
/// Configure activity-based Synchronization for the component
[ Synchronization( SynchronizationOption.Required ) ]
/// Indicate the type of class interface that will be generated for this
class
[ ClassInterface( ClassInterfaceType.None ) ]
public class FileTransfer:ServicedComponent,IFileTransfer
{
[ComVisible(true)]
[ AutoComplete(true) ]
public void UploadFile(string strURL, string strFilePath)
{
ContextUtil.DeactivateOnReturn = true;
// function performs some operations....
}
protected override bool CanBePooled()
{ // .. handle the CanBe Pooled message
// The base implementation returns false
return true;
}
}
}
Robert Jordan - 16 Sep 2005 22:03 GMT
Hi!
> I have written a serviced componet and added to the com+..
> When i call a function of this component the "Activated" count in the MMC
> increases and comes down as expected but if there is an error in the
> function call this object never gets deactivated. How do i make sure that
> the object gets deactivated even if there is an error..
What kind of activation are you using? Server or library?
Rob
Praveen - 19 Sep 2005 17:49 GMT
I am using Server activation.
Regards,
Praveen
> Hi!
>
[quoted text clipped - 7 lines]
>
> Rob