In the Silverlight project, the client interacts with the server data through the WCF Service by adding a Service Reference on the Silverlight client. In the client project, Silverlight generates a Service Reference named ServiceReference. clientConfig configuration file. The configuration file contains the Endpoint URL of the WCF Service, which directs the Silverlight client service request to the corresponding server service interface. By default, the Endpoint generated by the client is localhost. When an application is published, the address changes with the configuration of the Web server. As the default setting, each Web server configuration switch requires developers to manually modify the WCF Service configuration, and the Silverlight application cannot fully rely on the ServiceReference. ClientConfig configuration. This not only increases the maintenance cost, but also increases the difficulty of code maintenance. First, add the WCF Service to the project. By default, the ServiceReference. ClientConfig file is generated by Silverlight. It can be seen from the configuration file that the Endpoint is directed to the local device. <Configuration> <system. serviceModel> <bindings> <basicHttpBinding> <binding name = "BasicHttpBinding_ProxyService" maxBufferSize = "2147483647" maxcompute edmessagesize = "2147483647"> <security mode = "None"/> </binding> <binding name = "BasicHttpBinding_WidgetService" maxBufferSize = "2147483647" maxcompute edmessagesize = "2147483647"> <security mode = "None"/> </binding> </basicHttpBinding> </binings d> <client> <endpoint address =" http://localhost/WCFTest/ Proxy. svc "binding =" basicHttpBinding "bindingConfiguration =" BasicHttpBinding_ProxyService "contract =" WCFTestProxy. ProxyService "name =" BasicHttpBinding_ProxyService "/> <endpoint address =" http://localhost/WCFTest/ Widget. svc "binding =" basicHttpBinding "bindingConfiguration =" BasicHttpBinding_WidgetService "contract =" WCFTestWidgetService. widgetService "name =" BasicHttpBinding_WidgetService "/> </client> </system. serviceModel> </configuration> to dynamically set the Endpoint, a helper class DynamicEndpointHelper and public class DynamicEndpointHelper {// BaseUrl is the Web server address for service deployment. private const string BaseUrl =" http://localhost/WCFTest/ "; Public static string ResolveEndpointUrl (string endpointUrl, string xapPath) {string baseUrl = xapPath. substring (0, xapPath. indexOf ("ClientBin"); string relativeEndpointUrl = endpointUrl. substring (BaseUrl. length); string dynamicEndpointUrl = baseUrl + relativeEndpointUrl; return dynamicEndpointUrl;} on the Silverlight client, you can use the background code to dynamically set the Endpoint and private WCFTestProxy. proxyServiceClient GetProxyServ Ice () {WCFTestProxy. proxyServiceClient service = new WCFTestProxy. proxyServiceClient (); service. endpoint. address = new EndpointAddress (DynamicEndpointHelper. resolveEndpointUrl (service. endpoint. address. uri. toString (), App. current. host. source. toString (); return service;} after the proxy client service is created, the Endpoint address points to the currently running Web address. It is worth noting that this method can only support applications and services in the same domain. If the services are in different domains, you must configure cross-domain settings to complete dynamic settings.