没有合适的资源?快使用搜索试试~ 我知道了~
Introducing Windows Communication Foundation
4星 · 超过85%的资源 需积分: 9 8 下载量 57 浏览量
2012-07-27
17:11:59
上传
评论
收藏 676KB PDF 举报
温馨提示
试读
37页
The move to service-oriented communication has changed software development. Whether done with SOAP or in some other way, applications that interact through services have become the norm. For Windows developers, this change was made possible by Windows Communication Foundation (WCF). First released as part of the .NET Framework 3.0 in 2006, then updated in the .NET Framework 3.5, the most recent version of this technology is included in the .NET Framework 4. For a substantial share of new software built on .NET,WCF is the right foundation.
资源推荐
资源详情
资源评论
Introducing Windows Communication
Foundation
David Chappell, Chappell & Associates
January 2010
© Copyright Microsoft Corporation 2010. All rights reserved.
2
Contents
DESCRIBING WINDOWS COMMUNICATION FOUNDATION .................................................................................. 3
ILLUSTRATING THE PROBLEM: A SCENARIO ...................................................................................................................... 3
ADDRESSING THE PROBLEM: WHAT WCF PROVIDES ....................................................................................................... 5
Unification of Microsoft’s Distributed Computing Technologies ............................................................................ 6
Interoperability with Applications Built on Other Technologies .............................................................................. 8
Interoperability with Other Web Services Platforms .......................................................................................... 8
Interoperability with Microsoft‟s Pre-WCF Technologies ................................................................................. 11
Explicit Support for Service-Oriented Development ............................................................................................ 11
USING WINDOWS COMMUNICATION FOUNDATION ............................................................................................ 12
CREATING A WCF SERVICE .......................................................................................................................................... 12
Implementing a Service Class .............................................................................................................................. 12
Defining Service Contracts ............................................................................................................................... 13
Defining Data Contracts.................................................................................................................................... 16
Selecting a Host .................................................................................................................................................... 17
Hosting a Service Using IIS or WAS ................................................................................................................ 17
Hosting a Service in an Arbitrary Process ....................................................................................................... 17
Defining Endpoints ................................................................................................................................................ 18
Specifying Endpoints ........................................................................................................................................ 20
Using Endpoints: An Example .......................................................................................................................... 22
CREATING A WCF CLIENT ............................................................................................................................................ 23
OTHER ASPECTS OF WCF ............................................................................................................................................ 24
Messaging Options ............................................................................................................................................... 24
Controlling Local Behavior .................................................................................................................................... 25
Security .................................................................................................................................................................. 26
Transactions .......................................................................................................................................................... 27
Transactions in the .NET Framework: System.Transactions .......................................................................... 27
Transactions in WCF ........................................................................................................................................ 28
RESTful Communication ...................................................................................................................................... 29
Communication using POX, RSS, and ATOM .................................................................................................... 31
Queuing ................................................................................................................................................................. 32
Creating a Workflow Service ................................................................................................................................ 32
Extensibility ............................................................................................................................................................ 33
TOOL SUPPORT: WCF AND VISUAL STUDIO ................................................................................................................... 33
COEXISTENCE AND UPGRADE ................................................................................................................................ 34
CONCLUSION ............................................................................................................................................................... 37
ABOUT THE AUTHOR ................................................................................................................................................. 37
3
Describing Windows Communication Foundation
The move to service-oriented communication has changed software development. Whether
done with SOAP or in some other way, applications that interact through services have
become the norm. For Windows developers, this change was made possible by Windows
Communication Foundation (WCF). First released as part of the .NET Framework 3.0 in 2006,
then updated in the .NET Framework 3.5, the most recent version of this technology is
included in the .NET Framework 4. For a substantial share of new software built on .NET,
WCF is the right foundation.
Illustrating the Problem: A Scenario
To get a sense of the problems that WCF addresses, suppose that a car rental firm decides to
create a new application for reserving cars. Since this application will run on Windows, the firm
chooses to build it on the .NET Framework 4. The architects of this rental car reservation
application know that the business logic it implements will need to be accessible by other
software running both inside and outside their company. Accordingly, they decide to build it in
a service-oriented style, with the application‟s logic exposed to other software through a well-
defined set of services. To implement these services, the new application will use WCF. Figure
1 illustrates this situation.
4
Figure 1: The rental car reservation application provides WCF-based services that can be
accessed by various clients.
Over its lifetime, the rental car reservation application will likely be accessed by a range of
other applications. When it‟s designed, however, the architects of the rental car reservation
application know that its business logic will be accessed by three other kinds of software:
A client application running on Windows desktops that will be used by employees in the
organization‟s call center. Created specifically for the new reservations system, this
application will also be built using the .NET Framework 4 and WCF. (In some sense, this
application isn‟t truly distinct from the new rental car reservation application, since its only
purpose is to act as a client for the new system. Still, from a service-oriented perspective,
it‟s just another client for the reservation system‟s business logic.)
An existing reservation application built on a Java Platform, Enterprise Edition (Java EE)
server running on a non-Windows system. Due to a recent merger with another car rental
firm, this existing system must be able to access the new application‟s logic to provide
customers of the merged firms with a unified experience.
Partner applications running on a variety of platforms, each located within a company that
has a business arrangement with the car rental firm. Partners might include travel
agencies, airlines and others that are required to make car rental reservations.
5
The diverse communication requirements for the new rental car reservation application aren‟t
simple. For interactions with the call center client application, for instance, performance is
paramount, while interoperability is straightforward, since both are built on the .NET
Framework. For communication with the existing Java EE-based reservation application and
with the diverse partner applications, however, interoperability becomes the highest goal. The
security requirements are also quite different, varying across connections with local Windows-
based applications, a Java EE-based application running on another operating system, and a
variety of partner applications coming in across the Internet. Even transactional requirements
might vary, with only the internal applications being allowed to use distributed atomic
transactions. How can these diverse business and technical requirements be met without
exposing the creators of the new application to unmanageable complexity?
The answer to this question is WCF. Designed for exactly this kind of diverse but realistic
scenario, WCF is becoming the default technology for Windows applications that expose and
access services. This paper introduces WCF, examining what it provides and showing how it‟s
used. Throughout this introduction, the scenario just described will serve as an example. The
goal is to make clear what WCF is, illustrate the problems it addresses, and show how it solves
those problems.
Addressing the Problem: What WCF Provides
WCF is implemented primarily as a set of classes on top of the .NET Framework‟s Common
Language Runtime (CLR). This lets .NET developers build service-oriented applications in a
familiar way. As Figure 2 shows, WCF allows creating clients that access services. Both the
client and the service can run in pretty much any Windows process—WCF doesn‟t define a
required host. Wherever they run, clients and services can interact via SOAP, via a WCF-
specific binary protocol, and in other ways.
Figure 2: WCF-based clients and services can run in any Windows process.
As the scenario described earlier suggests, WCF addresses a range of problems for
communicating applications. Three things stand out, however, as WCF‟s most important
aspects:
Unification of the original .NET Framework communication technologies
Interoperability with applications built on other technologies
Explicit support for service-oriented development.
The following sections describe what WCF offers in each of these areas.
剩余36页未读,继续阅读
资源评论
- shenxinshan6211072012-10-21一份介绍wcf的技术文档,可以作为入门材料。
- lilife2014-01-15还行,刚学,讲的很清楚
webnet
- 粉丝: 1
- 资源: 8
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功