Late Binding Com : MissingMethodException

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi everybody,

I have created a c# module using late-binding to call methods of a com
component.
Everything works fine in a console application but when I use this module in
a web application I've got this exception : System.MissingMethodException:
Method System.__ComObject.MyMethod not found. Here is my code :

Type _UserComType = Type.GetTypeFromProgID("MyDll.MyClass");
object _UserCom = Activator.CreateInstance(_UserComType);

object[] parameters = new object[2];
parameters[0] = "Data1";
parameters[1] = "Data2";

object result = _UserComType.InvokeMember("MyMethod",
BindingFlags.InvokeMethod, null,_UserCom,parameters);

Does anybody have a idea to solve this problem ?
 
Are you sure you COM dll is registered and accessible from asp? And why are
you using late binding?


Willy.

| Hi everybody,
|
| I have created a c# module using late-binding to call methods of a com
| component.
| Everything works fine in a console application but when I use this module
in
| a web application I've got this exception : System.MissingMethodException:
| Method System.__ComObject.MyMethod not found. Here is my code :
|
| Type _UserComType = Type.GetTypeFromProgID("MyDll.MyClass");
| object _UserCom = Activator.CreateInstance(_UserComType);
|
| object[] parameters = new object[2];
| parameters[0] = "Data1";
| parameters[1] = "Data2";
|
| object result = _UserComType.InvokeMember("MyMethod",
| BindingFlags.InvokeMethod, null,_UserCom,parameters);
|
| Does anybody have a idea to solve this problem ?
 
The com is well registered and is accessible from asp. It's strange because
the com component is well found and the exception occurs on the method call
(invokemember).

We are migrating a COM module into a .Net module. During the migration
we need to have te possibility to switch between both module. When the
migration will be over we don't want to recompile the project to remove the
com reference.
This is the reason why I am using late binding.
 
Back
Top