A wide open clientaccesspolicy.xml file for developers

I recently installed some new WCF services on a different domain with SSL.  I was previously running them locally without SSL.  I know that I need a clientaccesspolicy.xml file to allow for cross-domain access.

I copied the one from microsoft here: http://msdn.microsoft.com/en-us/library/cc197955(v=vs.95).aspx

But that wouldn't work.    

 

The error I kept getting was:

An error occurred while trying to make a request to URI 'https://api.myservice.com/myservice.svc'. This could be due to attempting to access a service in a cross-domain way without a proper cross-domain policy in place, or a policy that is unsuitable for SOAP services. You may need to contact the owner of the service to publish a cross-domain policy file and to ensure it allows SOAP-related HTTP headers to be sent. This error may also be caused by using internal types in the web service proxy without using the InternalsVisibleToAttribute attribute. Please see the inner exception for more details.

The solution is to explicity add a https://* to the cross domain policy.  This actually is in the above Microsoft link, but I missed it!  I replaced <domain uri="*"/> with <domain uri="https://*" /> and it works now.

This is the file I'm using now.  

 One note: I've also got a domain uri for regular http://.  I don't need http:// access, but it won't work without it.  I am not going to spend time trying to figure that out right now, but I hope this helps somebody.

Scott

The SilverLight Developer Runtime Not Installed

How frustrating..it happened to me again today.  I downloaded some MVVM examples that Dan Wahlin recently put together for a talk on LIDNUG.  I loaded them up and hit F5.  At this point, my fingers are always crossed because usually projects do not run right of the bat without some tinkering.  This one compiled and started up IE and then gave me a small messagebox saying my version of Silverlight 4 needed updating.  So of course I downloaded the newest version thinking it was a fine and dandy.  Nope.  On the next press of F5 I got:

"Unable to start Debugging.The SilverLight Developer Runtime Not Installed. Please Install a matching version"

I've done this twice now.  I downloaded the end-user version of the runtime and that messed up my installation of the developer version.  So the solution is to re-install the developer version here:

http://go.microsoft.com/fwlink/?LinkID=188039

thanks to this post for saving my day.  Again.

 

 

Special characters in xaml

Here is a quick chart for displaying special characters in xaml

<    &lt;

>    &gt;

&    &amp;

"    &quot;

Items collection must be empty before using ItemsSource

In silverlight or WPF if you get the error:

"Items collection must be empty before using ItemsSource"

make sure you aren't populating the control with both the ItemsSource and adding children to the control in XAML.  In my case, I was setting ItemsSource after a call to a WCF service.  I had mistakingly also added a placeholder object in my XAML until I had written the WCF call.  Oops. 

Hope this helps somebody,

Scott

VS 2010 RC problem with missing ObservableCollection for WCF services

I'm back into Silverlight 3 now after a long break.  Since VS2010 RC was just released, I decided to upgrade my existing SL3 project and enjoy the benefits of a greatly improved IDE.  The project appeared to convert to just fine, but I had compile errors.  It seems my ObservableCollections were now arrays.  When attempting to update/configure a service reference, it chooses ( Custom ) and ObservableCollection is no longer a choice!

Somebody goofed at Microsoft and left out the ObservableCollection type.  To fix, you need to do this:

1.  Choose System.Collections.ObjectModel.Collection as the Collection type (instead of ( Custom )).

2.  Update, or configure your reference

3.  Find the reference.cs (or .vb) file (open windows explorer and find it in your Services References folder)

4.  Change all System.Collections.ObjectModel.Collection to System.Collections.ObjectModel.ObservableCollection.

 

Back in business.  I have no doubt they'll fix this by RTM, but that allows me to work with the RC and Silverlight/WCF.

I hope this helps somebody.  Happy programming.