-
Notifications
You must be signed in to change notification settings - Fork 18
WebServiceHost Overview
mikeobrien edited this page Sep 14, 2010
·
2 revisions
The WcfRestContrib.ServiceModel.Web.WebServiceHost offers a number of features to ease development of restful services.
- Ability to enable custom error handlers (See the Custom Error Handler Overview].
- Ability to set transfer mode.
- Ability to specify configuration behaviors (See the Declarative Binding & Behavior Overview).
- Ability to specify configuration bindings (See the Declarative Binding & Behavior Overview).
To use the WcfRestContrib.ServiceModel.Web.WebServiceHost simply change/add the service host factory in your service declaration to the WcfRestContrib.ServiceModel.Activation.WebServiceHostFactory as follows:
<%@ ServiceHost Language="C#" ... Service="NielsBohrLibrary.Books"
Factory="WcfRestContrib.ServiceModel.Activation.WebServiceHostFactory" %>
The WebServiceHost is configured with the WcfRestContrib.ServiceModel.Web.ServiceConfigurationAttribute. Apply this to the service and pass in your configuration. The following example demonstrates how to specify the custom error handler flag, transfer mode, binding configuration and behavior configuration:
[ServiceConfiguration(true, TransferMode.Streamed, "StreamedBinding", "RestBehavior")]
public class Content : IContentService {..}