Hi,
I am trying to call a web service from within a dll, with that dll
being loaded and called dynamically.
eg.
Assembly assembly = Assembly.LoadFile(@"C:\path\myfile.dll");
Type type = assembly.GetType("myfile.Class1");
object instance = Activator.CreateInstance(type);
object returnvalue = type.InvokeMember("MyMethod",
BindingFlags.InvokeMethod | BindingFlags.Default,
null, instance, null);
The assembly, type and instance are all populated correctly and I can
call other methods just fine, but as soon as I invoke "MyMethod" as
above, which calls a web service internally, it fails with a casting
error. Monitoring the web server shows that the web service was called
successfully but the response was incorrectly cast. Any ideas?
I know that the code within my dll is correct because if I reference
and call the method directly (eg. myfile.Class1 test= new
myfile.Class1(); test.MyMethod(); ) then the web service gets called
and completes successfully.
Hope someone can help,
Regards, Paul.