c# - How to crate WCF object of 2 WCF service dynamically based on endpoint name? -
i consuming 2 wcf service in 1 wcf service.
using wcfservice.server1; using wcfservice.server2;
i calling function returning endpoint name of suitable wcf service based on logic. how create object of wcf service based on endpoint name dynamically?
in below code created wcf object of "server1" wcf service suppose method returns endpoint name "server2endpoint" problem because referring wcfservice.server1
wcfservice.server1.matrixcalculationclient proxy1 = new wcfservice.server1.matrixcalculationclient("server1endpoint");
i assume both wcf services implements same interface, e.g. iwcfservice
.
then believe have use either own proxy class (which implements iwcfservice
independently of server1
or server2
) or construct channel manually using channelfactory<iwcfservice>
.
in both cases can pass name of endpoint proper constructors , work if app.config file contains correct definition of these endpoints (same contract).
Comments
Post a Comment