Attention: We are retiring the ASP.NET Community Blogs. Learn more >

Tip 2 : Silverlight-Enabled WCF Service Deployment: Modify ServiceReferences.ClientConfig

When deploying Silverlight application, you will need to unzip the xap file, modify ServiceReferences.ClientConfig, and zip back the xap file. While there are other options such as modifying the ServiceReferences.ClientConfig before the last build or using code to bypass the ServiceReferences.ClientConfig, the unzip/modify/zip approach is the best because it separates the concerns between development and deployment as well as coding and configuration.

For example, given a Demo.xap. To modify ServiceReferences.ClientConfig in the Demo.xap

1.       Rename Demo.xap to Demo.zip

2.       Right click Demo.zip, on the popup menu, click Extract All…

3.       Modify the extracted ServiceReferences.ClientConfig

4.       Create a compressed folder named Demo.zip

On the File menu, point to New, and click Compressed (zipped) Folder.

5.       Move all the extracted files into the Demo.zip folder

6.       Rename to the Demo.zip to Demo.xap

7.       Deploy the Demo.xap to the ClientBin folder

 

2 Comments

  • Another thing you can do is set the endpoint and binding in the code behind. I set my service URL as a key in my host web.config. I then pass this to the Silverlight control through the init params. I reflect on the URL to determine if the service is using SSL. This allows me to change the service URL without having to redeploy any .xap files. My service URL gets set in the web.config through an automated build process. So deploying between environments is completely automated.

  • Hello, I do think your web site could possibly be having browser compatibility issues.
    When I take a look at your site in Safari, it looks fine
    however when opening in Internet Explorer, it's got some overlapping issues. I merely wanted to provide you with a quick heads up! Aside from that, excellent blog!

Comments have been disabled for this content.