Windows Communication Foundation 4.0 (WCF 4.0) is a .NET-based application programming interface for building and running connected systems. It enables secure and reliable communication among systems within an organization or across the Internet. This book deals with the difficult issues faced by a .NET developer while working with WCF.
Chapter 1, Working with Contracts, shows how we can use Contract in WCF service development, including use cases of ServiceContract, DataContract, MessageContract, FaultContract, and so on.
Chapter 2, Endpoint, Binding, and Behavior, focuses on the basic building blocks of a WCF service, including endpoint, binding, and behavior. The recipes in this chapter demonstrate how to create various kinds of services by using the proper combination of these building blocks.
Chapter 3, Hosting and Configuration, covers several common and useful WCF service-hosting scenarios, such as hosting a WCF service in a Windows service, IIS web applications, and a WSS 3.0 site.
Chapter 4, Service Discovery and Proxy Generation, covers how to discover and consume WCF services. Recipes here demonstrate various scenarios of generating a WCF service proxy and introduces the service discovery feature in WCF 4.0.
Chapter 5, Channel and Messaging, digs into the channel layer of WCF programming and shows how to build WCF server and client applications through channel-layer components.
Chapter 6, Dealing with Data in Service, covers various data exchange and communication scenarios in WCF development. Recipes here include how to transfer XML and raw binary data or ADO.NET DataTable objects in service operations.
Chapter 7, Security, demonstrates how to utilize the built-in WCF security features such as service authentication, authorization, identity impersonation, message protection, and so on.
Chapter 8, Concurrency, introduces some typical cases about managing the concurrency and performance behaviors of a WCF service, such as how to use throttling settings and how to use Visual Studio testing tools for service performance tuning.
Chapter 9, Extending WCF Runtime, focuses on how to extend the existing components in the WCF programming model, such as customizing the default ServiceHost, using MessageInspector or MessageEncoder to intercept messages, customizing the service authorization logic, and so on.
Chapter 10, RESTful and AJAX-enabled WCF Services, provides several recipes on WCF REST service programming, including building a standard REST service, building an AJAX-enabled REST service, and consuming a remote REST service from an AJAX client.
Chapter 11, Interoperability, shows how to make a WCF service or client work with non-WCF or even non-.NET platform-based applications (such as a WebRequest client, legacy MSMQ client, or Microsoft Office client).
Chapter 12, Diagnostics, introduces some useful tools and skills for troubleshooting and diagnostics in WCF service development, including how to capture WCF messages, how to debug a Windows service host, how to use WCF performance counters, and so on.
Chapter 13, Miscellaneous WCF Development Tips, provides some additional skills and cases in WCF service development such as how to generate and manage test X.509 certificates and how to build an RSS feed and routing services.
Though all the samples in this book are C# based, you don't have to be a very experienced C# developer. What is required is that you have a development machine with Visual Studio 2010 (Professional or Ultimate edition) and IIS installed, since the sample code is provided as Visual Studio 2010 solutions and some of them use IIS as host.
If you work with Windows Communication Foundation 4.0 and want to be efficient when working with WCF features such as interoperability, proxy generation, and security, you will find this book very useful. With this book, you will be able to find quick and handy solutions for various kinds of service development scenarios using Microsoft Windows Communication Foundation 4.0. To follow the recipes, you will need to be comfortable with the .NET framework, C# programming, and the basics of SOA and how to develop them.
In this book, you will find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.
Code words in text are shown as follows: "There is also a corresponding WebInvokeAttribute
for a HTTP POST request."
A block of code is set as follows:
[ServiceContract] public interface IDataService { [OperationContract] string GetData(); }
When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:
[ServiceContract(Namespace="WCF.REST")]
public interface IDataService
{
[OperationContract]
[WebGet(ResponseFormat= WebMessageFormat.Json)]
SimpleData GetData();
}
Any command-line input or output is written as follows:
certmgr -c -r localmachine -s my
New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in the text like this: "Selecting Add Service Reference will launch a dialog where one can control the configuration options on how the WCF service proxy gets generated".
Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.
To send us general feedback, simply send an e-mail to <[email protected]>
, and mention the book title via the subject of your message.
If there is a book that you need and would like to see us publish, please send us a note in the SUGGEST A TITLE form on www.packtpub.com or e-mail <[email protected]>
.
If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on www.packtpub.com/authors.
Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.
Tip
Downloading the example code for this book
You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the files e-mailed directly to you.
Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you would report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/support, selecting your book, clicking on the errata submission form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded on our website, or added to any list of existing errata, under the Errata section of that title. Any existing errata can be viewed by selecting your title from http://www.packtpub.com/support.
Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works, in any form, on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.
Please contact us at <[email protected]>
with a link to the suspected pirated material.
We appreciate your help in protecting our authors, and our ability to bring you valuable content.
You can contact us at <[email protected]>
if you are having a problem with any aspect of the book, and we will do our best to address it.