TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Ramana
NA
25
59.2k
Getting 'exception has been thrown by the target of an invocation' Exception while calling a WCF method using Reflection
May 16 2011 12:42 AM
Hi,
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<WcfService1.IService1> myFactory = default(ChannelFactory<WcfService1.IService1>);
myFactory = new ChannelFactory<WcfService1.IService1>(new BasicHttpBinding(), "http://localhost:3250");
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
Reply
Answers (
2
)
Is it possible to implement IMAP/POP3 protocol in .NET without any 3rd party DLL?
How to call WCF service method using refelection in C#