WCF服务编程设计规范(7):WCF最佳实践《WCF Best Practice》资料下载与翻译

简介:
    今天继续《WCF服务编程设计规范》系列,今天推荐一下另外一个学习资料,并提供下载。作者是Brian Noyes,Juval Lowy 的同事。PPT资料《WCF Best Practice》,中文翻译为《WCF最佳实践》。今天内容主要包含,作者介绍,资料的目录结构,然后是翻译的前三部:服务定义、异常处理和安全。中英文对照。分享给大家。你可以下载英文版ppt。/Files/frank_xl/WCFBestPractices.pdf
【1】英文目录 Contents:
WCF Best Practice
    About Brian
    Agenda
    Service Definition
    Service Exception Handling
    Service Security
    Service Hosting
    Self Host Code
    Client Proxy Classes
    Client Proxy Management
    Client Exception Management
    Data Contracts
    SOAP vs. REST
【2】中文目录:
WCF 最佳实践
    关于Brian
    大纲
    服务定义
    服务异常处理
    服务安全
    服务托管
    自托管代码
    客户端代理类
    客户端代理管理
    客户端异常管理
    数据契约
    SOAP和REST

【3】英文名称:《WCF Best Practice》

中文名称:《WCF最佳实践》

【4】About Brian

关于Brian

Brian Noyes
Chief Architect, IDesign
IDesign  首席架构师
brian.noyes@idesign.net
Microsoft Regional Director
微软区域总监
Microsoft MVP Connected Systems
微软MVP
Publishing
出版
Ø  Developing Applications with Windows Workflow Foundation,
Ø  LiveLessons training DVD, June 2007
Ø  Smart Client Deployment with ClickOnce, Addison Wesley,January 2007
Ø  Data Binding in Windows Forms 2.0,
Ø  Addison Wesley, January 2006
Ø  MSDN Magazine, MSDN Online,
Ø  CoDe Magazine, The Server Side .NET,
Ø  asp.netPRO, Visual Studio Magazine
Speaking
讲座
Ø  Microsoft TechEd US, Europe, Malaysia,
Ø  Visual Studio Connections, DevTeach,
Ø  INETA Speakers Bureau, MSDN Webcasts
Ø E-mail: brian.noyes@idesign.net
Ø Blog: http://briannoyes.net
 

【5】Agenda

大纲

Service Best Practices
服务最佳实践
Client Best Practices
客户端最佳实践
Data Contracts
数据契约最佳实践
SOAP vs. REST
SOAP Rest

【6】Service Definition

服务定义

Separate contract from implementation
契约与实现分离
Ø Contract (interface) first
契约(接口)优先
Define services in a class library, not directly in a Host project
在类库里定义服务,不要在宿主项目里定义
Layering
分层
Ø Separate Service Layer?
划分服务层
Instance model
实例模型
Ø Change to Per Call as default
设置Per Call (单调模式)为默认值
Ø Session / Singleton when?
何时使用会话/ 与单例模式?

【7】Service Exception Handling

服务异常处理

For operation specific exceptions
为每个操作指定异常
Ø Try/catch, throw FaultException<T>
Try/catch ,抛出FaultException<T>
Favor using FaultException<T>
推荐使用FaultException<T>
Ø FaultException can be ambiguous to the client because unhandled exceptions arrive as a FaultException
FaultException 对于客户端来说过于模糊,因为未处理的异常都会在客户端表现为FaultException
Include FaultContract in service contract definition if you throw FaultExceptions
如果你要跑出异常,请在服务契约定义里包含FaultContract (错误契约)
Ø Part of the API you are exposing
就要暴露的API 的一部分
For global exception handling from services
对于来此服务全局的异常处理
Ø Use an error handler
使用错误处理
Include exception details in debug builds only
只有在调试的时候才会包含异常的详细信息

【8】Service Security

服务安全

Intranet services
企业局域网(以太网)服务
Ø Default Windows Auth may be all you need
默认使用Windows 验证
Ø Possibly Hybrid –Windows Creds / Custom Application Roles
或者使用Hybrid –Windows 凭据/ 自定义Application 角色
Extranet / Internet / Custom security needs
企业外部网络/ Internet/ 自定义安全需求
Use ASP.NET Membership / Role providers
使用ASP.NET Membership / Role providers
ASP.NET providers
ASP.NET providers
Ø Really a standard .NET framework security infrastructure
一个标准的.NET framework 安全基础结构
Ø Built in providers for Windows or SQL Server – based credentials / roles
providers 里为Windows SQL Server 内建了基于凭据/ 角色的安全机制
Ø Easy to implement custom providers
容易实现自定义providers
Ø Establish principal on the thread
线程上建立principal
Ø Re-usable across ASP.NET, WCF, WPF & Windows Forms (via Client Application Services)
Ø  可以跨越ASP.NET WCF WPF   Windows Forms ( 通过客户端应用程序服务)


 本文转自 frankxulei 51CTO博客,原文链接:http://blog.51cto.com/frankxulei/318665 ,如需转载请自行联系原作者



相关文章
|
9月前
|
前端开发
WCF更新服务引用报错的原因之一
WCF更新服务引用报错的原因之一
|
8月前
|
C# 数据安全/隐私保护
c#如何创建WCF服务到发布(SqlServer版已经验证)
c#如何创建WCF服务到发布(SqlServer版已经验证)
38 0
|
8月前
|
安全 数据库连接 数据库
WCF服务创建到发布(SqlServer版)
在本示例开始之前,让我们先来了解一下什么是wcf? wcf有哪些特点? wcf是一个面向服务编程的综合分层架构。该架构的项层为服务模型层。 使用户用最少的时间和精力建立自己的软件产品和外界通信的模型。它使得开发者能够建立一个跨平台的安全、可信赖、事务性的解决方案。且能与已有系统兼容写作。 简单概括就是:一组数据通信的应用程序开发接口。
58 0
Visual Studio 2022 创建 WCF服务 找不到
Visual Studio 2022 创建 WCF服务 找不到
|
C++
WCF基础教程(二)——解析iis8和iis8.5+VS2013发布wcf服务问题
WCF基础教程(二)——解析iis8和iis8.5+VS2013发布wcf服务问题
102 0
WCF基础教程(二)——解析iis8和iis8.5+VS2013发布wcf服务问题
WCF使用纯代码的方式进行服务寄宿
服务寄宿的目的是为了开启一个进程,为WCF服务提供一个运行的环境。通过为服务添加一个或者多个终结点,使之暴露给潜在的服务消费,服务消费者通过匹配的终结点对该服务进行调用,除去上面的两种寄宿方式,还可以以纯代码的方式实现服务的寄宿工作。
850 0
|
Windows
WCF服务寄宿到IIS
一.WCF简介: Windows Communication Foundation(WCF)是由微软开发的一系列支持数据通信的应用程序框架,可以翻译为Windows 通讯开发平台。整合了原有的windows通讯的 .net Remoting,WebService,Socket的机制,并融合有HTTP和FTP的相关技术。
1048 0
WCF服务自我寄宿
WCF服务的寄宿方式 WCF寄宿方式是一种非常灵活的操作,可以寄宿在各种进程之中,常见的寄宿有: IIS服务、Windows服务、Winform程序、控制台程序中进行寄宿,从而实现WCF服务的运行,为调用者方便、高效提供服务调用。
996 0
|
网络架构
(纯代码)快速创建wcf rest 服务
因为有一个小工具需要和其它的业务对接数据,所以就试一下看能不能弄一个无需配置快速对接的方法出来,百(以)度(讹)过(传)后(讹),最后还是对照wcf配置对象调试出来了: 1.创建WebHttpBinding 2.
979 0