Servicehost Customization

1,146 views

Published on

There’s no doubt that building a distributed system with WCF is
much easier than with any other Microsoft technology.

But, how can we be sure that we are doing it the right way?

In this session we will go over common scenarios developer face when
building and hosting WCF services:

1. Error handling
2. Serialization issue
3. Choocing the instanse model
4. Extendable object

and see how widening the WCF ServiceHost in the infrastructure level
can help us to build a robust, reliable and manageable system.

Published in: Technology, Business
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,146
On SlideShare
0
From Embeds
0
Number of Embeds
28
Actions
Shares
0
Downloads
23
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Servicehost Customization

  1. 1. Building a ServiceHost for your WCF Services - the Right Way ! Eyal Vardi CEO Experts4D Microsoft VSTO MVP blog: www.eVardi.com
  2. 2. Agenda <ul><li>Service Description </li></ul><ul><li>Service Pipeline </li></ul><ul><li>Serialization issue </li></ul><ul><li>Extensible Object Pattern </li></ul><ul><li>Error Handler </li></ul><ul><li>Q&A </li></ul><ul><li>Summary </li></ul>
  3. 3. Consulting Mentoring Projects
  4. 4. Service Description (Metadata) <ul><li>It describe all aspects of the service, endpoints & behaviors ( A, B, C, Be ) </li></ul><ul><ul><li>new ServiceHost( typeof(Hello) ) </li></ul></ul>Service Host Service Description Config Service Interfaces Code Service Model Layer Message Layer WSDL
  5. 5. Configuration Manager for WCF ServiceHost ServiceHost ServiceHost Id Id Id Config Manager Application Launcher
  6. 6. ServiceHost (Service Description)
  7. 7. Inside WCF Pipeline (Receiver) Message Layer Service Model Layer Service Service Description Behaviors
  8. 8. How to manipulate the pipeline Service Host Channel Dispatcher Endpoint Dispatcher Dispatch Runtime Dispatch Operation Service Description Endpoint Contract Binding Operation Message I Service Behavior I Endpoint Behavior I Contract Behavior I Opertion Behavior
  9. 9. WCF Behavior Classes <ul><li>WCF have built-in attribute and configuration element to customize the pipeline. </li></ul>
  10. 10. WCF Pipeline Configuration Options Service CD ED ED DR DR DO DO DO DO <ul><li>ServiceThrottle </li></ul><ul><li>ErrorHandlers </li></ul><ul><li>Endpoints </li></ul><ul><li>Timeouts </li></ul><ul><li>Address Filter </li></ul><ul><li>Contract Filter </li></ul>Method Method Method Method C ontract Be haviors <ul><li>Message Behavior </li></ul><ul><li>Instance Behavior </li></ul><ul><li>Security Behavior </li></ul><ul><li>Formatter </li></ul><ul><li>Parameter Inspector </li></ul><ul><li>Invoker </li></ul>
  11. 11. Error Handling Extensions <ul><li>ServiceThrottle </li></ul><ul><li>ErrorHandlers </li></ul><ul><li>Endpoints </li></ul><ul><li>Timeouts </li></ul>
  12. 12. Error Handler Error Handlers CD ED DR DO
  13. 13. The Extensible Object Pattern <ul><li>Extend existing runtime classes with: </li></ul><ul><ul><li>New functionality </li></ul></ul><ul><ul><li>New state to an object </li></ul></ul>
  14. 14. Persistence State in Service
  15. 15. Persistence State in Service Serivce Serivce Serivce Instance Context Service Host Extenstion Extenstion
  16. 16. Extensible Object Extensible Object CD ED DR DO
  17. 17. Instance Pool
  18. 18. Instance Pool Instance Pool CD ED DR DO
  19. 19. Serialization Issue <ul><li>public UserInfo EchoUser ( int userId ); </li></ul>Encoding Deserialization Serialization Encoding Binding Transport
  20. 20. DispatchOperation.Formatter <ul><li>Type coupled </li></ul><ul><li>Loosely coupled </li></ul><ul><li>Known Type </li></ul><ul><li>IExtensibleDataObject </li></ul>DeserializeRequest SerializeReply
  21. 21. OO Formatter Formatter CD ED DR DO
  22. 22. Serialization issue Example Consumer Provider infrastructure
  23. 23. OO Formatter OO Formatter CD ED DR DO
  24. 25. Summary <ul><li>Service Description </li></ul><ul><li>Service Pipeline </li></ul><ul><li>Serialization issue </li></ul><ul><li>The Extensible Object Pattern </li></ul><ul><li>Error Handler </li></ul>
  25. 26. Resources <ul><li>www.Experts4D.com / Eyal </li></ul><ul><li>www.NetFX3.com </li></ul><ul><li>http://code.msdn.com/wcfvisualizer </li></ul>

×