The silverlight app does NOT look at the web.config of the hosting server at all - that is on the server side and not visible to the silverlight app which is running on the client. The Silverlight app looks in its own ServiceReferences.clientconfig file or at the URL that you specify programmatically when you create the local service proxy in code.
So, you have 2 options:
1. Modify ServiceReferences.clientconfig before you build the deployable version of the Silverlight app.
2. Use code to construct your client-side endpoints with URL's.
We use the 2nd option because we like to have a standard programmatic interface that configures our endpoints. We do something like this (but not with the MaxValue's if it is a public facing service, of course):
public ImportServiceClient CreateImportServiceClient()
{
return new ImportServiceClient(GetBinding(), GetServiceEndpoint("ImportService.svc"));
}
public ExportServiceClient CreateExportServiceClient()
{
return new ExportServiceClient(GetBinding(), GetServiceEndpoint("ExportService.svc"));
}
protected override System.ServiceModel.Channels.Binding GetBinding()
{
BasicHttpBinding binding = new BasicHttpBinding(BasicHttpSecurityMode.None);
binding.MaxBufferSize = int.MaxValue;
binding.MaxReceivedMessageSize = int.MaxValue;
binding.SendTimeout = TimeSpan.MaxValue;
binding.ReceiveTimeout = TimeSpan.MaxValue;
return binding;
}
protected EndpointAddress GetServiceEndpoint(string serviceName)
{
if (Settings == null)
{
throw new Exception("Service settings not set");
}
return
new EndpointAddress(ConcatenateUri(Settings.ServiceUri,serviceName));
}
protected EndpointAddress GetServiceEndpoint(string serviceName, Uri address)
{
if (Settings == null)
{
throw new Exception("Service settings not set");
}
return new EndpointAddress(ConcatenateUri(address, serviceName));
}
The classes like "ImportServiceClient" and "ExportServiceClient" are the generated proxies from creating service references to our WCF services. Settings.ServiceUri is where we store the address of the server that we should be talking to (in our case it is set dynamically via parameters to the silverlight plugin in the page it is hosted in, but you could use whatever scheme you like to manage this address).
But if you prefer to simply tweak ServiceReferences.ClientConfig then you don't need any code like this.