views:

74

answers:

2

Hi,

i've made a service reference from my silverlight app to my local dev server. but now i want to deploy this on the testserver, but how can i change the uri of the dataservice now? all i deploy is a XAP file, and in the asp.net world i was used to change the uri in the web.config, but obviously that isn't present in a silverlight app?

+4  A: 

Your Silverlight application should have merged the ServiceReferences.ClientConfig into your web.config file. You will find it under:

<system.serviceModel>
    <bindings>
        <!-- Your binding details here -->
    </bindings>
    <client>
        <endpoint address="http://localhost/servicename/servicename.svc"
           binding="basicHttpBinding" 
           bindingConfiguration="BasicHttpBinding_Iservicename"
           contract="servicenameReference.Iservicename"
           name="BasicHttpBinding_Iservicename" />
    </client>
</system.serverModel>

Amend the address to point to the production server.

Ardman
But the web.config is in my web site, and not on the client's computer, is it? So how is the silverlight app in the browser in it's XAP file connecting to the web.config to see the endpoint address?
Michel
Correct, the web.config is on the Server which the XAP file talks too.
Ardman
@Ardman, i think the point is that the Silverlight app hasn't determined where the server is?
slugster
+3  A: 

See this answer for some details on how to set your WCF proxy end point programmatically. Doing it this way means you can avoid putting any address information in your config file.

slugster
@slugster: +1. I may have mis-read the question.
Ardman
Yeah! that did the trick.
Michel