Dynamically switch WCF Web Service Reference URL path through config file

后端 未结 5 2042
误落风尘
误落风尘 2020-12-01 02:56

How do you dynamically switch WCF Web Service Reference URL path through config file ?

5条回答
  •  伪装坚强ぢ
    2020-12-01 03:26

    Just to expand on the answer from Erin: -

    MyClient client = new MyService.MyClient();
    client.Endpoint.Address = new EndpointAddress(new Uri("insert new url here"),
        client.Endpoint.Address.Identity, client.Endpoint.Address.Headers);
    client.Open();
    

    HTH!

提交回复
热议问题