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 1115787
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T03:12:28+00:00 2026-05-17T03:12:28+00:00

I have multiple services in my application. WebService1, WebService2,WebService3 and so on.. All the

  • 0

I have multiple services in my application. WebService1, WebService2,WebService3 and so on..

All the services have same methods, but they are hosted on different IPs.

Now when a client calls a methodA(1) then

WebService1Client.Method() should be called;

client calls a methodA(2) then WebService2Client.Method() should be called.

I do not want to do a switch case for each and every function on the client.

I would rather prefer to create some class/methods which would return the appropriate proxyClient.

How can I create a class to return the object and further how to use that object.

Please point me to some sample codes or references.

Thanks

  • 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-17T03:12:28+00:00Added an answer on May 17, 2026 at 3:12 am

    If all your services implement the same contract (I mean exactly the same, not a contract with the same methods), you can simply create proxies using the ChannelFactory class and cast the returned object into the contract interface.

    This should give you the expected generic behavior.

    One way to ensure the same interface is used all over is to put it into a separate class library and share it between all projects. Make sure you configure your service references to reuse types in referenced assemblies.

    EDIT: This is how you would use the ChannelFactory, you can get rid of the service reference:

    BasicHttpBinding myBinding = new BasicHttpBinding();
    EndpointAddress myEndpoint = new EndpointAddress("http://localhost/MathService/Ep1");
    ChannelFactory<IMath> myChannelFactory = new ChannelFactory<IMath>(myBinding, myEndpoint);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using Parsley in my flex mobile project. I have multiple destination services but
I have multiple daemons (one gateway and multiple service, all running on same node)
I am having multiple Services in my application.i have a datacontract that i need
I have a web application with multiple web services. This web application has business
I have an application that interacts multiple databases and some custom services. For some
We have multiple WCF services all working with InstanceContextMode=PerCall and all WCF service instances
I have a requirement to store the list of services for multiple computers. I
I have an ASP.NET MVC 3 Solution(C#) Containing multiple projects. There is a services
I have setup multiple SQL Service Broker Queues in a database but have not
We have a setup where we have multiple instances of an application - one

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.