Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Silverlight3 WCF Exceptions


Published on

How return .NET WCF exceptions to Silverlight clients.

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Silverlight3 WCF Exceptions

  1. 1. Silverlight 3 WCF Exceptions “Down the Rabbit Hole” Presented by William Austin [email_address]
  2. 4. Down the Rabbit Hole
  3. 5. <ul><li>“ Alice discovers during her travels that things are not what they seem” </li></ul><ul><li>Her experiences in Wonderland challenge her understanding of the world. </li></ul>
  4. 6. Our Rabbit Hole Static Proxy file generation WCF Behaviors WebDev Helper IEndPoint Behavior Reference.cs HTTP Traffic sniffing ClientAccessPolicy.xml BehaviorExtensionElement IDispatchMessageInspector basicHTTPBinding The service returned an error : Not Found
  5. 7. Code Demo #1 <ul><li>The Happy Path </li></ul>
  6. 8. Summary of Demo <ul><li>Importance of clientaccesspolicy.xml </li></ul><ul><li>Default wsHTTPBinding </li></ul>
  7. 9. Code Demo #2 <ul><li>Exceptions thrown on the WCF service side. </li></ul>
  8. 10. <ul><li>WCF FaultException<> </li></ul><ul><li>Modifying service, requires Update Service in client. </li></ul><ul><li>Inspect HTTP traffic </li></ul><ul><li>Cast e.Error to FaultException<T> </li></ul><ul><li>… And it STILL doesn’t work. </li></ul>Summary of Demo 2
  9. 11. Code Demo 3 <ul><li>Silverlight is hosted within the browser (mostly…) </li></ul>
  10. 12. <ul><li>Convert HTTP500 to HTTP200 </li></ul><ul><li>WCF Behavior, web.config, dynamic </li></ul><ul><li>BehaviorExtensionElement, IEndpointBehavior, and IDispatchMessageInspector are your friends. </li></ul>Summary of Demo 3
  11. 13. Lessons learned <ul><li>WCF FaultException<> and Silverlight3 </li></ul><ul><li>BehaviorExtensionElement, IEndpointBehavior, and IDispatchMessageInspector </li></ul><ul><li>Silverlight runs within the browser </li></ul>
  12. 14. Useful Article Links <ul><li>Understanding WCF Faults in Silverlight 3 </li></ul><ul><li> </li></ul><ul><li>Consuming Web Services in Microsoft Silverlight 3 </li></ul><ul><li> (beta 3.0, up to the 30:00 minute mark) </li></ul><ul><li>Creating and Handling Faults in Silverlight </li></ul><ul><li> </li></ul>
  13. 15. Are you mad?? <ul><li>? </li></ul>
  14. 16. <ul><li>“ We’re all mad here…” </li></ul><ul><li>“If you weren’t mad, you </li></ul><ul><li>wouldn’t be here” </li></ul>
  15. 17. Silverlight 3 WCF Exceptions “Down the Rabbit Hole” Presented by William Austin