Invoking WCF functions using Reflection

Posted by Jankhana on Stack Overflow See other posts from Stack Overflow or by Jankhana
Published on 2010-03-18T13:43:55Z Indexed on 2010/03/19 4:41 UTC
Read the original article Hit count: 776

Filed under:
|
|

I am pretty new to WCF applications. I have a WCF application that is using NetTcpBinding. I wanted to invoke the functions in WCF service using the System.Reflection's Methodbase Invoke method. I mean I wanted to Dynamically call the Function by passing the String as the Function name. Reflection works great for Web Service or a Windows application or any dll or class. So their is certain way to do this for WCF also but I am not able to find that. I am getting the Assembly Name than it's type everything fine but as we cannot create an instance of the Interface class I tried to open the WCF connection using the binding and tried to pass that object but it's throwing the exception as :

"Object does not match target type."

I have opened the connection and passed the object and type is of interface only. I don't know whether I'm trying wrong thing or in wrong way. Any idea how shall I accomplish this??? The NetTCPBinding all are properly given while opening the connection. And one more thing I am using WCF as a Windows Service using NETTCPBinding.

© Stack Overflow or respective owner

Related posts about c#

Related posts about wcf