Andrew_Shough


I hope someone out there has had this error before or knows what I have done wrong.

I am busy writting a Com+ service that will provide a Word Document Object to a program we are developing. I am busy writing the base of it as it were, just getting the service class without the Word handling done, and getting it registered to check if we can access it.

What happens is when I register the dll (regsvcs -fc ...) it tells me that there is an unknown error and goes on about ComVisibility.

I have created the class, and set various attributes, of those that you won't see in the code below is [assembly: AssemblyKeyFile("wordService.snk")] and [assembly: ApplicationActivation(ActivationOption.Server)] which are in AssemblyInfo.cs. Below is all my code for the dll, I have changed some of the names to protect our client and copyrights etc.

namespace wordService
{
[InterfaceType(ComInterfaceType.InterfaceIsDual)]
[ComVisible(false)]
public interface iWordService
{
void RequestWordObject(ref object _newObject);
}

[ObjectPooling(MinPoolSize=1,MaxPoolSize=16,CreationTimeout=60000)]
[Transaction(TransactionOption.Required)]
[MustRunInClientContext(false)]
[EventTrackingEnabled(true)]
[JustInTimeActivation(true)]
[ConstructionEnabled(true,Default="companyName WordService")]
[Synchronization(SynchronizationOption.Required)]
[ClassInterface(ClassInterfaceType.AutoDual)]

[ComVisible(true)]
class WordService: ServicedComponent, iWordService
{
#region Private Members
private Microsoft.Office.Interop.Word.ApplicationClass _wordObject;
#endregion

#region Constructors

public WordService()
{
_wordObject = new Microsoft.Office.Interop.Word.ApplicationClass();
}
#endregion

#region iWordService Members

//[AutoComplete(true)]
public void RequestWordObject(ref object _newObject)
{
try
{
_newObject = _wordObject.GetType();
}
catch (Exception e)
{
ContextUtil.SetAbort();
_newObject = null;
}

ContextUtil.SetComplete();
}
#endregion

#region Overidden Members
public bool CanBePooled()
{
return base.CanBePooled();
}

public void Construct(string s)
{
base.Construct(s);
}

public void Activate()
{
if (_wordObject == null)
_wordObject = new Microsoft.Office.Interop.Word.ApplicationClass();

base.Activate();
}

public void Deactivate()
{
if (_wordObject != null)
_wordObject = null;
base.Deactivate();
}

#endregion
}
}


Re: COM+ Service registration error



databaseforum