I hate SilverLight

How to Start

SilverLight sdk or toolkit or whatever bootstrap installation package doesn’t come with VS2008, all kinds of confusions when looking for “How to start”. The default IIS setting doesn’t support xap either.


Somewhere the magic cache (Server or Browser?) stop me from seeing my code change. I had to delete the clientBin folder, then clean my IE temp files, then to see my changes. Is there a easy way?

clientaccesspolicy.xml never works on my machine! Even silverlight app and WCF service are on the same IIS server. I had to go through the non-localhost host name to visit my localhost.

WCF FaultExcetption

SilverLight can’t consume regular / default WCF service, I had to add the basic http binding to WCF service just like what I did to expose WCF service to PowerBuidler, but, SilverLight doesn’t know WCF FaultException! I had to use fiddler to see the exception/stack info in the traffic to figure out what’s going on.

Add FaultContract  into ServiceContract will make WCF serice unavialable to silverlight.   There is a workaround to put faultexception into out parameter, but we can’t go this way because our service is shared, not only for silverlight. what I figured out is, it’s safe to add fautdetail as customized fault, do NOT  inherited from Exception type.

The easiest way for me is just changing httpstatus code from 500 to 200, the silverlight client side still keeps same:

        private void Application_Startup(object sender, StartupEventArgs e)

                var client = new AglcSecureWebServiceClient();

                client.ServcieCallCompleted += client_ServcieCallCompleted;


        private void client_ServcieCallCompleted(object sender, ServcieCallCompletedEventArgs e)

                // good call , continue ...

            catch (Exception err)
                Exception innerException = err.InnerException;

                if (innerException is FaultException<MyFault>)
                    Debug.WriteLine("FaultException occoured: " + innerException.Message);
                    // business code ...
                }else if(innerException is CommunicationException)
                    MessageBox.Show("Communication exception occoured."+ innerException.Message);
//                    throw err; // depends app design, hide or throw.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s