I have a project that has a service reference to a web service. Is there a way from the codebehind to get the actual http address of the service reference?
Thanks
I have a project that has a service reference to a web service. Is there a way from the codebehind to get the actual http address of the service reference?
Thanks
You could retrieve it from the client proxy that was generated for you:
using (var client = new ServiceReference1.MyServiceClient("*"))
{
string address = client.Endpoint.Address.Uri.ToString();
}
or if you are having multiple endpoints in your config file:
using (var client = new ServiceReference1.MyServiceClient("MyService"))
{
var address = client.Endpoint.Address.Uri.ToString();
}
© 2022 - 2024 — McMap. All rights reserved.