none
How to change the ServiceReference.ClientConfig file after Application is deployed?

    Question

  • How to change the settings in the ServiceReference.ClientConfig file after the Application is deployed? Anybody knows the answer to this question?

    If I understand it correctly,  the ServiceReference.ClientConfig is compiled into the .Xap. If that is the case, how do we change the Url setting in that file after the final build of our application? Because in most cases, the Url need to be specified after we deploy our application to our customer site. How do we do this?

     

     

    Thursday, June 12, 2008 4:33 PM

Answers

All replies

  •  Bump!

    Anybody knows? Or no body even need to do this?

     

    Thursday, June 12, 2008 10:01 PM
  • Hi:

      I  think in final build you can manually change the endpoint address in that file.

    Regards

    Sunday, June 15, 2008 11:13 PM
  •  

    Hi:

      I  think in final build you can manually change the endpoint address in that file.

    Allen,

    We have a lot of customers. Our application is not just one Web site we host. The customers purchase our products which is a web application and host it themselves. So in our product final build we can not hard code that endpoint address for them. They should be able to config it to their need like they might host their WCF service in one Server or on the same Web Server.  We do not do a build for each customer. Once we have a final release build, all the customers would get the same copy. So if that ClientConfig file is in the .Xap, how do our customer change that once they get our product?

     

    Monday, June 16, 2008 9:03 AM
  • You can open .xap files using WinRar or other archivator. Edit ServiceReferences.config opening it by Notepad

    Monday, June 16, 2008 10:37 AM
  • You can open .xap files using WinRar or other archivator. Edit ServiceReferences.config opening it by Notepad

     

    So when I save it,  the file in the .Xap will be updated, and the .Xap is still valid?  

     

    Monday, June 16, 2008 10:47 AM
  • I tried it on my machine - write in address of service invalid url, opened host website and changed it to valid url in xap. App didn't worked with invalid url, but worked with valid

    Monday, June 16, 2008 11:52 AM
  • Thanks for this tip. I just download WinRar and tried it.  So basically we just need to re-zip(or should I say re-Xap) it after we change the clientconfig file. That should do it.

    But WinRar is a 3rd party software, dose Microsoft has something similar so we can use to do this? Some customers just do not want to do this kind of thing if they have to download some 3rd party tool.

     

     

     

    Monday, June 16, 2008 12:01 PM
  • You can use sharpziplib, it's open source:
    http://sharpdevelop.net/OpenSource/SharpZipLib/Default.aspx

     

    Monday, June 16, 2008 12:45 PM
  • a better to do this is to set the service address dynamically by codes, assuming that you can figure out the url.

    you can update endpoint address by: 

    proxy.Endpoint.Address = new EndpointAddress(http://.../*.svc);

    this can be more flexible.

    Wednesday, September 10, 2008 11:59 AM
  • I use the unzip -> config -> rezip method all the time. It works very well. I don't find a code approach to be any more flexible unless you are always doing a site-of-origin service call.

    Pete

    Wednesday, September 10, 2008 12:27 PM
  • This is the right way to do.

     


    Tuesday, September 08, 2009 9:03 PM
  • I also had the same problem, I really need to redeploy xap files everytime when there is a bugfix. So basically it's 20 times a week on our test servers, so I made a little application to do the work for me in orde to save some time. You can read about it here: http://vanderbiest.org/blog/2010/01/10/silverlight-clientconfig-file-injection/
    Sunday, January 10, 2010 10:05 AM
  • There's really no reason to ever have to touch your file. Why go through the effort or even write a tool?

    Just create a base class that auto-senses the url and updates the service reference dynamically ... then you can deploy anywhere and use the same XAP.

    http://csharperimage.jeremylikness.com/2009/07/abstracting-wcf-service-calls-in.html

     

    Sunday, January 10, 2010 2:58 PM
  • There's really no reason to ever have to touch your file. Why go through the effort or even write a tool?

    Just create a base class that auto-senses the url and updates the service reference dynamically ... then you can deploy anywhere and use the same XAP.

    http://csharperimage.jeremylikness.com/2009/07/abstracting-wcf-service-calls-in.html

     

    Hello Jeremy, I must have overlooked your solution. It is the perfect way to point always to the right service. I'll give it a try and put a link prior to the application (it was fun to make anyways :))
    Sunday, January 10, 2010 5:26 PM
  •  Hello,

    Is there a reason I have no such file in any of my silverlight applications?

    Friday, January 15, 2010 8:45 PM
  • Wednesday, January 20, 2010 6:04 AM
  • salam alkom

    thanks thanks thanks aloy really you saved my time

    Tuesday, September 20, 2011 1:54 AM
  • are you guys sure that unzipping .xap file and changing the config file and zipping it back as .xap file work? i tried that and the application couldnot open in the browser. i did this on server btw
    Monday, May 13, 2013 2:57 PM