Dynamically send WCF endpoint in Silverlight
This is how I do it (we determine the host and select the appropriate endpoint).// these are the endpoints define in the webconfig filestring LocalHostEndpointName = "LocalHost_Endpoint";string ProductionEndpointName = "Production_Endpoint";string CurrentEndpoint = "";//...
This is how I do it (we determine the host and select the appropriate endpoint).
// these are the endpoints define in the webconfig file
string LocalHostEndpointName = "LocalHost_Endpoint";
string ProductionEndpointName = "Production_Endpoint";
string CurrentEndpoint = "";
// this is the code we use to determine the correct endpoint
string host = Application.Current.Host.Source.Host.ToLower();
host = (string.IsNullOrEmpty(host)) ? "localhost" : host;
switch (host)
{
case "localhost" : CurrentEndpoint = LocalHostEndpointName; break;
default : CurrentEndpoint = ProductionEndpointName; break;
}
webService = new Svc.MyServiceClient(CurrentEndpoint);