I'm getting "exception has been thrown by the target of an invocation" while calling a wcf service method at the client side using reflection.
I'm getting the exception while invoking the method at the line:
object result = oMeth.Invoke(oProxy,@params);
Here is my service :
public string GetData(int value)
{
return string.Format("You entered: {0}", value);
}
my client side code:
ChannelFactory
myFactory = new ChannelFactory
object oProxy = myFactory.CreateChannel();
Type oType = oProxy.GetType();
MethodInfo oMeth = oType.GetMethod("GetData");
object[] @params = { 3 };
object result = oMeth.Invoke(oProxy,@params);
Plz help if know the solution.
Thanks & Regards,
Ramana
VulpesPosted May 16, 2011, 9:17 AM
Suthish NairPosted May 16, 2011, 1:50 AM
Use a Try - Catch block and try to capture inner exception error message.
You need to do a good web search for the solution.
exception has been thrown by the target of an invocation + wcf
exception has been thrown by the target of an invocation