使用 wcf 开发 rest 服务 -- 在 windows server appfabric 上,在云端

32

Upload: philip-moreno

Post on 31-Dec-2015

146 views

Category:

Documents


10 download

DESCRIPTION

DEV-LANG-300-4. 薛敏敏 项 目经理 文 凌 软件开发工程师 微软(中国)研发集团服务器及开发工具事业部. 使用 WCF 开发 REST 服务 -- 在 Windows Server AppFabric 上,在云端. 议程. 关于 HTTP 和 REST 的开场白 WCF HTTP 服务之开发部署初体验 WCF HTTP 服务之 4.0 增强版 WCF HTTP 服务之演进开始 展望 -- 在下一代 VS 中的 WCF HTTP 疑问和解答. 在 Web 上,创建服务可以像创建网页那样 …. HTTP 是 Web 的应用层. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: 使用 WCF 开发 REST 服务 --  在 Windows Server AppFabric 上,在云端
Page 2: 使用 WCF 开发 REST 服务 --  在 Windows Server AppFabric 上,在云端

使用 WCF 开发 REST 服务-- 在 Windows Server AppFabric 上,在云端

DEV-LANG-300-4

薛敏敏 项目经理 文凌 软件开发工程师微软(中国)研发集团服务器及开发工具事业部

Page 3: 使用 WCF 开发 REST 服务 --  在 Windows Server AppFabric 上,在云端

议程

关于 HTTP 和 REST 的开场白WCF HTTP 服务之开发部署初体验WCF HTTP 服务之 4.0 增强版WCF HTTP 服务之演进开始展望 -- 在下一代 VS 中的 WCF HTTP疑问和解答

Page 4: 使用 WCF 开发 REST 服务 --  在 Windows Server AppFabric 上,在云端

在 Web 上,创建服务可以像创建网页那样 …

Page 5: 使用 WCF 开发 REST 服务 --  在 Windows Server AppFabric 上,在云端

HTTP 是 Web 的应用层

参数 (Uri, 媒体类型 , 编码 )

消息 (Request, Response, Headers)

实体 (Headers / Body)

方法 (Verbs)

状态码

内容协商 (Content Negotiation)

缓存

认证

Page 6: 使用 WCF 开发 REST 服务 --  在 Windows Server AppFabric 上,在云端

REST 和 HTTP

REST 是关于:如何利用 HTTP 构建网络互联系统遵循一定的原则

以创建:简单可见可扩展高性能易更改

的服务

Page 7: 使用 WCF 开发 REST 服务 --  在 Windows Server AppFabric 上,在云端

REST 的原则

资源

统一接口 无状态化

表述与链接URI

Page 8: 使用 WCF 开发 REST 服务 --  在 Windows Server AppFabric 上,在云端

REST 日趋主流

Microsoft Live Services

Windows Azure Storage Service

WCFData Services

EVERYBODY that isn’t Microsoft

(Google, Twitter, Facebook)

使用和创建云计算服务

Page 9: 使用 WCF 开发 REST 服务 --  在 Windows Server AppFabric 上,在云端

WCF 服务家族

Channel Model

格式(Atom, JSON, XML,…)

传输(HTTP, TCP, …)

协议(SOAP, HTTP, Open Data

Protocol,…)

Service Model

数据合同 服务合同 服务行为

Programming Model

SOAP服务

HTTP 服务

Data 服务

RIA 服务

Workflow 服务

Page 10: 使用 WCF 开发 REST 服务 --  在 Windows Server AppFabric 上,在云端

WCF HTTP 服务之开发部署初体验

创建

开发部署

Page 11: 使用 WCF 开发 REST 服务 --  在 Windows Server AppFabric 上,在云端

资源

WCF HTTP 服务之开发部署初体验-- 创建服务

Page 12: 使用 WCF 开发 REST 服务 --  在 Windows Server AppFabric 上,在云端

微博服务

用户

博文

关注

粉丝

推荐

WCF HTTP 服务之开发部署初体验-- 创建服务

Page 13: 使用 WCF 开发 REST 服务 --  在 Windows Server AppFabric 上,在云端

WCF HTTP 服务之开发部署初体验-- 创建服务

资源 URI

Page 14: 使用 WCF 开发 REST 服务 --  在 Windows Server AppFabric 上,在云端

资源 URI 模板 方法用户 /users/{username} GET, PUT, DELETE

用户 /users POST

博文 /blogs/{id} GET, DELETE, PUT

博文 /blogs POST

关注 /follows/{from}.{to} DELETE, PUT, GET

关注 /follows POST

某用户的所有博客列表 /users/{username}/blogs GET

某用户的关注的所有博客列表

/users/{username}/allblogs GET

某用户某年某月的所有博客 /users/{username}/blogs/{year}/{month}

GET

推荐给某用户的用户列表 /users/{username}/recommends GET

某用户的所有粉丝列表 /users/{username}/fans GET

某用户关注的所有人列表 /users/{username}/follows GET

WCF HTTP 服务之开发部署初体验-- 创建服务

Page 15: 使用 WCF 开发 REST 服务 --  在 Windows Server AppFabric 上,在云端

WCF HTTP 服务之开发部署初体验-- 创建服务

资源 URI 服务

Page 16: 使用 WCF 开发 REST 服务 --  在 Windows Server AppFabric 上,在云端

演 示创建、开发微博服务微博服务部署到内部环境和云端文凌软件开发工程师微软(中国)研发集团服务器及开发工具事业部

Page 17: 使用 WCF 开发 REST 服务 --  在 Windows Server AppFabric 上,在云端

WCF HTTP 服务之 4.0 增强版

新特性组合出击

Page 18: 使用 WCF 开发 REST 服务 --  在 Windows Server AppFabric 上,在云端

WCF HTTP 服务之 4.0 增强版-- WCF4 新特性

简化编程 :• WebFaultException

更方便服务的调用 :• 帮助页

更灵活的格式选择 :• 自动 XML/JSON 切换• 指定格式

进一步的缓存支持 :• 声明式缓存 [AspNetCacheProfile]• Conditional GET & PUT

简化的配置 :• 标准终结点• ASP.NET Route 的集成

Page 19: 使用 WCF 开发 REST 服务 --  在 Windows Server AppFabric 上,在云端

演 示使用 WCF HTTP 新特性

文凌软件开发工程师微软(中国)研发集团服务器及开发工具事业部

Page 20: 使用 WCF 开发 REST 服务 --  在 Windows Server AppFabric 上,在云端

WCF HTTP 服务之演进

WCF CodePlex 尝鲜

Page 21: 使用 WCF 开发 REST 服务 --  在 Windows Server AppFabric 上,在云端

我的格式我做主

Page 22: 使用 WCF 开发 REST 服务 --  在 Windows Server AppFabric 上,在云端

Media type formatting

Uri template parameters

Model Binding

请求 响应

HttpResult handling

Media type formatting

Content Negotiation

WCF HTTP 服务之演进-- 管道 (Pipeline)

Page 23: 使用 WCF 开发 REST 服务 --  在 Windows Server AppFabric 上,在云端

HTTP 成为一等公民

Page 24: 使用 WCF 开发 REST 服务 --  在 Windows Server AppFabric 上,在云端

查我所爱随心所欲

Page 25: 使用 WCF 开发 REST 服务 --  在 Windows Server AppFabric 上,在云端

WCF HTTP 服务之演进-- 组合查询

Page 26: 使用 WCF 开发 REST 服务 --  在 Windows Server AppFabric 上,在云端

演 示使用 WCF CodePlex 新功能

文凌软件开发工程师微软(中国)研发集团服务器及开发工具事业部

Page 27: 使用 WCF 开发 REST 服务 --  在 Windows Server AppFabric 上,在云端

展望 -- 在下一代 VS 中的 WCF HTTP

WCF 工具 --WCF HTTP 服

务开发更轻松

项目模板

测试客户端

预发布

添加服务引用

WCF 框架II

更好地支持HTTP

Page 28: 使用 WCF 开发 REST 服务 --  在 Windows Server AppFabric 上,在云端

28

相关课程分会场一DEV-LANG-300-5 下一代中间件平台 AppFabric 纵览

分会场三DEV-LANG-300-2 使用 WF 4 实现您的流程 – 在 Windows Server AppFabric 上,在云端

动手实验室四DEVHOL-300-1 Web 服务开发管理新体验 – WCF 4 + Windows Server AppFabric

动手实验室四DEVHOL-300-2 Windows Server AppFabric 入门

动手实验室四DEVHOL-300-3 建立您的第一个工作流应用 (Level 300)

Page 29: 使用 WCF 开发 REST 服务 --  在 Windows Server AppFabric 上,在云端

疑 问 和 解 答

Page 30: 使用 WCF 开发 REST 服务 --  在 Windows Server AppFabric 上,在云端

参考资源WCF 文档中心http://msdn.microsoft.com/en-us/netframework/first-steps-with-wcf.aspx

团队博客http://blogs.msdn.com/b/endpoint/http://blogs.msdn.com/b/wcftoolsteamblogcn/

WCF CodePlexhttp://wcf.codeplex.com/

Page 31: 使用 WCF 开发 REST 服务 --  在 Windows Server AppFabric 上,在云端

感谢您参与此会场!您的意见与建议对我们非常重要。

请您填写反馈表。

Page 32: 使用 WCF 开发 REST 服务 --  在 Windows Server AppFabric 上,在云端

© 2008 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED

OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.