Using Service Templates with Indigo - Service Configuration Editor
(Page 2 of 4 )
The Service Configuration Editor is another tool that is installed with the Windows SDK for .NET 3.0--an executable file named svcconfigeditor.exe. This tool is a wizard that helps you configure service model settings for WCF clients and services. You can launch the Service Configuration Editor directly from Solution Explorer to edit the <system.serviceModel> section for any client or host application configuration file (as the lab illustrates). The wizard guides you through steps to configure services, bindings, behaviors, and more, which is particularly useful when you are new to WCF since you may not be familiar with each section of the configuration file.
The service model configuration for clients and service are both encapsulated within the<system.serviceModel>configuration section so you can use this tool to edit both sides. When starting from scratch, you can use the tool to add new services or client endpoints, to attach behaviors to services or endpoints, to supply base addresses for the host, to supply metadata exchange endpoints, and even to customize binding configurations (something I'll talk about in Chapter 3). For existing applications, you may just use the tool to view settings and make minor changes.
As I show you configuration settings throughout this book, I'll talk about many settings in the<system.serviceModel>section--all of which can be configured using the Service Configuration Editor. But you'll find that as you gain more experience with<system.serviceModel>settings, it is much more productive to edit the configuration file directly, relying on Intellisense.
ServiceModel Configuration
This lab illustrates the use of declarative configuration settings to configure the ServiceHost and the client proxy--although, in the latter case, you generated the configuration. Both ServiceHost and proxy types rely on programmatic or declarative configuration to initialize endpoints and configure behaviors. The latter technique provides greater deployment flexibility while programmatic settings enable you to enforce certain settings. In this section I'll focus on the service model configuration settings.
All configuration settings related to the service model are contained within the<system.serviceModel>section new to WCF. Any application configuration file can contain this section, which means app.config for executables, and web.config for web sites. The service model is vast and there are many configuration options, most of which will be explored throughout the book. However, the core elements of this configuration you will repeatedly use are:<services>,<client>,<bindings>,<behaviors>. Table 1-1 provides a brief explanation of each section.
Table 1-1. Summary of core <system.ServiceModel> sections
| Section | Description |
| <services> | This element contains one or more<service>definitions. Each<service>section is associated with a particular service type and includes any base addresses and endpoints to be exposed for that type. |
| <client> | This element contains one or more<endpoint>definitions for each service endpoint the client may consume. Each individual<endpoint>includes an address, binding, and contract matching a service endpoint. Client proxies select an endpoint to configure the client communication channel. |
| <bindings> | This element contains one or more binding configuration sections. This makes it possible to customize a binding instead of using the defaults provided by a standard binding, such asBasicHttpBinding. I'll explore bindings in Chapter 3. |
| <behaviors> | This element contains<serviceBehaviors>and<clientBehaviors>. At the host, the <service>configuration section may reference an element from the<serviceBehaviors>section to apply local behavioral settings to the service. At the client, endpoints defined in the<client> section may reference an element from the<clientBehaviors>section to apply local behavioral settings to the client communication channel. |
Service model configuration settings can also be set at runtime through the proxy orServiceHost; however, declarative configuration is often preferred to hardcoding settings in code. You can modify configuration files without impacting the compiled service or client code and this supports more flexible deployment scenarios.
Throughout this book, you will see examples that configure the service model in code where there are practical applications for it.
Next: ServiceHost Initialization >>
More BrainDump Articles
More By O'Reilly Media
|
This article is excerpted from chapter 1 of the book Learning WCF A Hands-on Guide, written by Michele Leroux Bustamante (O'Reilly, 2007; ISBN: 0596101627). Check it out today at your favorite bookstore. Buy this book now.
|
|