Soap server address in silverlight
In my silverlight light apps im normally connecting to a ASMX or WCF web service.
I was wond开发者_高级运维er what is the best way of holding the url in the app of where the soap client should be looking at.
This is fine in debug because it just sort of knows, but in release and depending where its using an ip or it swaps production servers i keep getting tripped up.
I would love there to be some sort of client config bit like web config
Your service endpoints can go in to a ServiceReferences.ClientConfig file. This is then an XML file and can be changed at any point as needed; ie..at deployment, etc...
You can have client configuration by using Isolated Storage.
You work with Key/Value pairs as in this example from the linked page:
// Create an instance of IsolatedStorageSettings.
private IsolatedStorageSettings userSettings =
IsolatedStorageSettings.ApplicationSettings;
// Add a key and its value.
userSettings.Add("userImage", "BlueHills.jpg");
// Remove the setting.
userSettings.Remove("userImage");
So you can have the value as your URL - just choose a suitable key.
精彩评论