WCF(二) endpoint
2015-06-04 14:04
183 查看
为什么要了解endpoint?
各个应用程序的通信是以“终结点(Endpoint)”的来实现的
Binding:Binding实现在Client和Service通信的所有底层细节。比如Client与Service之间传递的Message是如何编码的——text/XML, binary,MTOM;这种Message的传递是采用的哪种Transport——TCP, Http, Named Pipe, MSMQ; 以及采用怎样的机制解决Secure Messaging的问题——SSL,Message Level Security。所以Binding解决的是How to communicate with service?
Contract: Contract的主要的作用是暴露某个WCF Service所提供的所有有效的Functionality。从Message Exchange的层面上讲,Contract实际上是抱每个Operation转化成为相对应的Message Exchange Pattern——MEP(Request/Response; One-way; Duplex)。所以Contract解决的是What functionalities do the Service provide?
Behavior: Behavior的主要作用是定制Endpoint在运行时的一些必要的Behavior。比如Service 回调Client的Timeout;Client采用的Credential type;以及是否支持Transaction等。
Endpoint相关的信息都具有两种定义方式——Managed Code 和Configuration
一般我们采取Configuration配置的方式实现可定制化的过程
各个应用程序的通信是以“终结点(Endpoint)”的来实现的
Endpoint的组成
Address: Address通过一个URI唯一地标识一个Endpoint,并告诉潜在的WCF service的调用者如何找到这个EndpointBinding:Binding:Binding实现在Client和Service通信的所有底层细节。比如Client与Service之间传递的Message是如何编码的——text/XML, binary,MTOM;这种Message的传递是采用的哪种Transport——TCP, Http, Named Pipe, MSMQ; 以及采用怎样的机制解决Secure Messaging的问题——SSL,Message Level Security。所以Binding解决的是How to communicate with service?
Contract: Contract的主要的作用是暴露某个WCF Service所提供的所有有效的Functionality。从Message Exchange的层面上讲,Contract实际上是抱每个Operation转化成为相对应的Message Exchange Pattern——MEP(Request/Response; One-way; Duplex)。所以Contract解决的是What functionalities do the Service provide?
Behavior: Behavior的主要作用是定制Endpoint在运行时的一些必要的Behavior。比如Service 回调Client的Timeout;Client采用的Credential type;以及是否支持Transaction等。
如何设置endpoint
一个endpoint必须包含A,B,C三个元素<system.serviceModel> <bindings> <basicHttpBinding> <binding name="BasicHttpBinding_IMyFirstSerice" /> </basicHttpBinding> </bindings> <client> <endpoint address="http://localhost:13961/MyFirstSerice.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IMyFirstSerice" contract="ServiceReference1.IMyFirstSerice" name="BasicHttpBinding_IMyFirstSerice" /> </client> </system.serviceModel>
Endpoint相关的信息都具有两种定义方式——Managed Code 和Configuration
一般我们采取Configuration配置的方式实现可定制化的过程
相关文章推荐
- C#实现json的序列化和反序列化
- SQL处理XML
- 辨别 “百度权重”作弊的手法
- call_user_func_array函数
- 数字视频概述
- 使用 ftrace 调试 Linux 内核 (二)
- 【莫比乌斯反演】[BZOJ2820]YY的GCD
- 开发中遇到的问题(2015-06-04)
- Android解析XML资源
- GIT
- 关于MySQL5.6.25在Win7 64bit下重装后无法启动的解决方法
- 003-C运算符
- VS 插件
- 纸上得来终觉浅
- JavaScript学习笔记(一)
- 从Linux内核中获取真随机数【转】
- 点双连通分量的求解
- protobuf repeated类型的使用
- 使用git stash储藏你的工作
- 减小VirtualBox虚拟硬盘文件的大小