<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Nathan Bridgewater &#187; deployment</title>
	<atom:link href="http://www.integratedwebsystems.com/tag/deployment/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.integratedwebsystems.com</link>
	<description>My Little .NET Sandbox</description>
	<lastBuildDate>Fri, 10 Sep 2010 16:13:08 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Silverlight Deployment and WCF Endpoints</title>
		<link>http://www.integratedwebsystems.com/2009/04/silverlight-deployment-and-wcf-endpoints/</link>
		<comments>http://www.integratedwebsystems.com/2009/04/silverlight-deployment-and-wcf-endpoints/#comments</comments>
		<pubDate>Mon, 27 Apr 2009 18:31:04 +0000</pubDate>
		<dc:creator>Nathan</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[WCF]]></category>
		<category><![CDATA[deployment]]></category>
		<category><![CDATA[endpoint]]></category>

		<guid isPermaLink="false">http://www.integratedwebsystems.com/index.php/2009/04/silverlight-deployment-and-wcf-endpoints/</guid>
		<description><![CDATA[I&#8217;m sure this has been written about a ton, but why not repost some useful information. When using Silverlight with WCF, you quickly learn about the cross-domain restrictions. It becomes a huge pain when deploying from dev to production because you have to deploy and configure your Silverlight using the prod endpoint address, which for [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m sure this has been written about a ton, but why not repost some useful information.</p>
<p>When using Silverlight with WCF, you quickly learn about the cross-domain restrictions. It becomes a huge pain when deploying from dev to production because you have to deploy and configure your Silverlight using the prod endpoint address, which for me at least didn&#8217;t always work. So what I found was that quite a few people are setting their WCF client end points on the fly using the current host during runtime. It&#8217;s relatively easy to do, and since they both are typically deployed at the same time, it works out pretty well.</p>
<p>This snippet strips away the ClientBin/xxx.xap from the application source and retains the application root URL.</p>
<pre class="brush: csharp; gutter: false; toolbar: false;">string full = Application.Current.Host.Source.AbsoluteUri;
full = full.Substring(0, full.LastIndexOf('/')) + "/../";</pre>
<p>You can then put this functionality into a utility class for your application and make it very easy to consume when using WCF services. Using the music manager service from a previous post, we have:</p>
<pre class="brush: csharp; gutter: false; toolbar: false;">MusicManagerService.MusicManagerServiceClient client;
client = new MusicPlayer.MusicManagerService.MusicManagerServiceClient();

//use dynamic endpoint
client.Endpoint.Address = new System.ServiceModel.EndpointAddress(full + "MusicManager.svc"); 

client.GetFilesCompleted +=new EventHandler&lt;MusicPlayer.MusicManagerService.GetFilesCompletedEventArgs&gt;(client_GetFilesCompleted);
client.GetFilesAsync(uxSearchString.Text.Trim());</pre>
<p>For deployment, you just xcopy your published web app to the deployment directory and you&#8217;re done. No reconfiguring/recompiling necessary.</p>
<p>Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.integratedwebsystems.com/2009/04/silverlight-deployment-and-wcf-endpoints/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
