I have many services in my application
All services have the same method, but they are different Hosted on IP.
Now when a client calls a method A (1) then
WebService1Client.Method () should be called;
The client calls a method A (2) Then WebService2Client.Method () should be called.
I do not
I like to build some class / methods that will bring the appropriate proxy client back.
How do I create
Please pay attention to some sample codes or references.
Thanks
If all your services have the same contract (mine That is exactly the same, there is no contract in the same way), you can create a proxy using only the channelfitcher and enter the returned object in the contract interface.
This should give you the expected generic behavior.
One way to ensure the same interface is to put it in a different class library and share it among all projects.
EDIT: In this way how you will use ChannelFactory, you can get rid of the service context:
Basic Httpbinding myBinding = New BasicHttpBinding (); Endpoint Address My Idpoint = New Endpoint Address ("http: // localhost / MathService / Ep1"); ChannelFactory & LT; IMath & gt; MyChannelFactory = New Channel Factor & lt; IMath & gt; (Minding, MyDayPoint);
Comments
Post a Comment