Advanced WCF

360 views

Published on

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

  • Be the first to like this

No Downloads
Views
Total views
360
On SlideShare
0
From Embeds
0
Number of Embeds
5
Actions
Shares
0
Downloads
8
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Advanced WCF

  1. 1. WCF Tips and Tricks
  2. 2. Components Contract Behavior Endpoint
  3. 3. Streaming • When to use: – Data is too big and the transfer needs to be buffered – Data should be processed by chunks • Limitations: – Supported not in all bindings – Streaming methods can have only one parameter – Session is not supported when streaming data Streaming alternatives? DIY! (do it yourself) You can create several methods that will return data in chunks.
  4. 4. Message Contracts • When to use: – You need full control of SOAP messages – You want to pass additional information with response (like security, etc.) – You want to add additional information with request, but don’t want to mess the interface for compatibility purposes – Useful together with streaming option
  5. 5. Duplex Contracts sd Use Case Model WCF Client WCF Service GetData() getcallbackchannel() CallDuplexMethod()
  6. 6. • When to use: – You need to define two-way communication between client and server – You need to notify client about some event • Limitations: – Duplex behavior is working only within a client session
  7. 7. Create WCF client in code. • Why? – More control over client proxy – Want to track changes to the WCF client implementation • How? – Use of ClientBase – ChannelFactory
  8. 8. Service Discovery • Announcement endpoints – Useful to notify other clients about service start/stop • Metadata exchange (mex) – Defines endpoint which provides information about service interface • WS-Discovery – Enables service discovery on the network
  9. 9. Questions
  10. 10. Thanks
  11. 11. Useful links: • Service discovery: http://msdn.microsoft.com/en- us/library/dd456791%28v=vs.110%29.aspx • ClientBase: http://msdn.microsoft.com/ru- ru/library/ms576141%28v=vs.110%29.aspx • ChannelFactory: http://msdn.microsoft.com/ru- ru/library/ms734681%28v=vs.110%29.aspx • Duplex services: http://msdn.microsoft.com/ru- ru/library/ms731064%28v=vs.110%29.aspx • Message contract: http://msdn.microsoft.com/ru- ru/library/ms730255%28v=vs.110%29.aspx • Streaming: http://msdn.microsoft.com/en- us/library/ms733742%28v=vs.110%29.aspx

×