Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 683013
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T01:39:37+00:00 2026-05-14T01:39:37+00:00

I have a WCF application that is using NetTcpBinding . I want to invoke

  • 0

I have a WCF application that is using NetTcpBinding. I want to invoke the functions in WCF service using Methodbase.Invoke from the System.Reflection namespace. In other words I want to Dynamically call a Function by passing a String as the Function name.

Reflection works great for Web Service or a Windows application or any DLL or class. So there is certainly a way to do this for WCF but I am unable to find out how.

I am getting the Assembly Name then 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 an 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 the wrong thing or am using the wrong way. Any idea how I can accomplish this?

The NetTCPBinding all are properly given while opening the connection. I am using WCF as a Windows Service using NETTCPBinding.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T01:39:37+00:00Added an answer on May 14, 2026 at 1:39 am

    You are passing the correct instance when you invoke your method. This instance is the proxy object created via the interface-based call to ChannelFactory. I tried your technique on a hello world style application and got the expected results. One thing I don’t see in your code example is how you initialize the parameters. That could be a problem. I believe think that your call to Type.GetType may be causing the error you are receiving. Notice I call GetType on the Proxy object. I include my sample code below that calls a Function GetData that takes one argument as an integer.
    …

     Dim myFactory As ChannelFactory(Of SimpleService.IService1)
        myFactory = New ChannelFactory(Of SimpleService.IService1)(myBinding, myEndpoint)
        oProxy = myFactory.CreateChannel()
        'commented out version that does same call without reflection
        ' oProxy.GetData(3)
       Dim oType As Type = oProxy.GetType
       Dim oMeth As MethodInfo = oType.GetMethod("GetData")
       Dim params() As Object = {3}
       Dim sResults As String
       sResults = oMeth.Invoke(oProxy, BindingFlags.Public Or BindingFlags.InvokeMethod, Nothing, params, System.Globalization.CultureInfo.CurrentCulture)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 339k
  • Answers 339k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer The provider pattern definitely had its day, but these days… May 14, 2026 at 4:25 am
  • Editorial Team
    Editorial Team added an answer SQL CE should work OK, but no: you don't have… May 14, 2026 at 4:25 am
  • Editorial Team
    Editorial Team added an answer Seems to work: public class Test { public static void… May 14, 2026 at 4:25 am

Related Questions

I need to secure a WCF service that uses netTcpBinding and connects directly with
I currently have a WCF Service with a CallBack Contract (duplex), and when I
I have a number of WCF services on my internal network which are hosted
I'm looking to create a rich-featured application using a client/server model, using WCF as
I have a c# multi-threaded monte carlo simulation , the application is already structured

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.