Late Binding Com : MissingMethodException

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 ?
 
W

Willy Denoyette [MVP]

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 ?
 
G

Guest

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top