AlexZh
9/4/2007 11:01:00 PM
I read a lot of threads trying th solve the problem but with no
success.
I have my own very simple .Net com (C#). In the project properties I
set "Register for COM interop", so all the registration is done.
In my client code I had:
Type myComType = Type.GetTypeFromProgID(ProgId,"",true);
Object com = Activator.CreateInstance(myComType);
Activator.CreateInstance() always throws an exception "Class not
registered".
So, I've change the code to:
Type myComType = Type.GetTypeFromProgID(ProgId,"",true);
Type myComTypeEx = Type.GetTypeFromCLSID(myComType .GUID);
Object com = Activator.CreateInstance(myComTypeEx);
That works just fine.
However I must do it on a remote machine. So, I've change the code to:
Type myComType = Type.GetTypeFromProgID(ProgId,srvrName,true);
Type myComTypeEx = Type.GetTypeFromCLSID(myComType .GUID, srvrName);
Object com = Activator.CreateInstance(myComTypeEx);
That case Activator.CreateInstance always throws the same exception
"Class not registered".
You help is highly appreciated.
Alex