Programming WCF Services - Operation

1.默认的方式为请求Request-应答Reply的方式。

2.One-Way方式。没有返回值(只能是void),不需要Client关心调用结果的成功/失败。但是不等于异步。

原因:当Client 发出多个One-Way Call,如果来不及处理的话,WCF将放入Queue,一旦QUEUE的长度超过Threshhold,Client将会Blocked.

[ServiceContract]

public interface IMyContract

{

 [Operation Contract(IsOneWay= true)]

  void MyMethod();

}

One-Way方式,建议只用在Per-Call or Singleton Service.

3.Callback回调,比如对Event的支持,双向通信模式下才支持,比如:NetTcpBinding和NetNamedPipeBinding绑定以及WSDualHttpBinding绑定。

(1) 服务端定义和配置Callback Contract

[ServiceContract]

public interface ICallbackContract

{

   [OperationContract]

   void OnCallback();

}

[ServiceContract(CallbackContract = typeof(ICallbackContract)]

public interfact IMyContract

{

 [OperationContract]
   intDoSomething(  );

}

(2)客户端实现ICallbackContract

public class MyCallback : IMyContractCallback
{
   public void OnCallback(  )
   {...}
}

IMyContractCallback callback = new MyCallback(  );
InstanceContext context = new InstanceContext(callback);

4.Streaming技术,如果传递的Message太大的话,会使Client被Blocked.

Streaming Transfer Mode技术:WFC使得接收方在接收大的Message同时,能够开始处理Message.

 

 

 

 

 

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
2015.11.30即将出版新书 Programming WCF Services: Design and Build Maintainable Service-Oriented Systems 4th Paperback: 1018 pages Publisher: Media; 4 edition (November 30, 2015) Language: English ISBN-10: 1491944838 ISBN-13: 978-1491944837 Programming WCF Services is the authoritative, bestselling guide to Microsoft’s unified platform for developing modern, service-oriented applications on Windows. Hailed as the definitive treatment of WCF, this guide provides unique insight, rather than documentation, to help you learn the topics and skills you need for building maintainable, extensible, and reusable WCF-based applications. Authors Juval Löwy—one of the world’s top .NET experts—and Michael Montgomery have revised this edition to include the productivity-enhancing features of .NET Framework 4.6, along with the latest WCF ideas and techniques. By teaching you the why and the how of WCF programming, this book will help you master WCF and make you a better software engineer. Learn WCF’s architecture and essential building blocks, including key concepts such as reliability and transport sessions Use built-in features such as service contracts, instance and concurrency management, transactions, queued services, and security Increase the quality of your WCF services by using design options, tips, and best practices in Löwy’s ServiceModelEx framework Understand the rationale behind particular design decisions, and rarely understood aspects of WCF development Learn why Azure Service Fabric is the killer app for modern DevOps

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值