WebScriptEnablingBehavior Class

Definition

Provides support for the behavior that enables Windows Communication Foundation (WCF) endpoints to receive HTTP requests from a browser-based ASP.NET AJAX client. This class cannot be inherited.

public ref class WebScriptEnablingBehavior sealed : System::ServiceModel::Description::WebHttpBehavior
public sealed class WebScriptEnablingBehavior : System.ServiceModel.Description.WebHttpBehavior
type WebScriptEnablingBehavior = class
    inherit WebHttpBehavior
Public NotInheritable Class WebScriptEnablingBehavior
Inherits WebHttpBehavior
Inheritance
WebScriptEnablingBehavior

Remarks

When applied to an endpoint, the WebScriptEnablingBehavior behavior enables WCF and ASP.NET AJAX integration, except for the support required for JavaScript Object Notation (JSON) encoding. Various types of encoding, including JSON, are enabled by the WebMessageEncodingElement or by an appropriately configured WebHttpBinding. The WebScriptEnablingBehavior behavior implements the IEndpointBehavior and inherits from WebHttpBehavior, which enables the more general Web programming model for WCF services exposing non-SOAP endpoints.

Specifically, the WebScriptEnablingBehavior:

  • Enables the HTTP programming model, including dispatch to operations based on a URL suffix, support for HTTP verb selection (POST or GET) and HTTP cache duration control. For more information about the HTTP programming model, see WCF Web HTTP Programming Model Overview. Note that the default HTTP verb is POST when using this behavior.

  • Enables the correct formatter for each operation's request and response messages - for example, support for URL parameters.

  • Enables the JavaScript Proxy endpoint.

To call a WCF service from an ASP.NET AJAX client, the service must be configured with the WebHttpBinding binding and the WebScriptEnablingBehavior must be added to the endpoint behavior collection. This can be done either in configuration by adding the WebScriptEnablingElement or without using configuration by activating the AJAX endpoint with the WebScriptServiceHostFactory instead of the default factory in the @ServiceHost directive in the .svc file.

For more information about different ways to enable a WCF service to respond to ASP.NET AJAX clients, see Creating WCF Services for ASP.NET AJAX.

Constructors

WebScriptEnablingBehavior()

Initializes a new instance of the WebScriptEnablingBehavior class.

Properties

AutomaticFormatSelectionEnabled

Gets or sets a value that determines if automatic format selection is enabled.

DefaultBodyStyle

Gets or sets the default message body style.

DefaultOutgoingRequestFormat

Gets or sets the default outgoing request message format.

DefaultOutgoingResponseFormat

Gets or sets the default outgoing response message format.

FaultExceptionEnabled

Gets or sets the flag that specifies whether a FaultException is generated when an internal server error (HTTP status code: 500) occurs.

HelpEnabled

Gets or sets a value that determines if the WCF REST Help page is enabled.

JavascriptCallbackParameterName

Gets or sets the JavaScript callback parameter name.

(Inherited from WebHttpBehavior)

Methods

AddBindingParameters(ServiceEndpoint, BindingParameterCollection)

Implements the AddBindingParameters(ServiceEndpoint, BindingParameterCollection) method to pass data at runtime to bindings to support custom behavior.

(Inherited from WebHttpBehavior)
AddClientErrorInspector(ServiceEndpoint, ClientRuntime)

Adds a client error inspector to the specified service endpoint.

(Inherited from WebHttpBehavior)
AddServerErrorHandlers(ServiceEndpoint, EndpointDispatcher)

Override this method to change the way errors that occur on the service are handled.

(Inherited from WebHttpBehavior)
ApplyClientBehavior(ServiceEndpoint, ClientRuntime)

Applies the behavior to the client across an endpoint.

ApplyDispatchBehavior(ServiceEndpoint, EndpointDispatcher)

Applies the behavior to the service endpoint.

Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetOperationSelector(ServiceEndpoint)

Creates a new WebHttpDispatchOperationSelector object.

(Inherited from WebHttpBehavior)
GetQueryStringConverter(OperationDescription)

Gets the query string converter.

(Inherited from WebHttpBehavior)
GetReplyClientFormatter(OperationDescription, ServiceEndpoint)

Gets the reply formatter on the client for the specified endpoint and service operation.

(Inherited from WebHttpBehavior)
GetReplyDispatchFormatter(OperationDescription, ServiceEndpoint)

Gets the reply formatter on the service for the specified endpoint and service operation.

(Inherited from WebHttpBehavior)
GetRequestClientFormatter(OperationDescription, ServiceEndpoint)

Gets the request formatter on the client for the specified service operation and endpoint.

(Inherited from WebHttpBehavior)
GetRequestDispatchFormatter(OperationDescription, ServiceEndpoint)

Gets the request formatter on the service for the given service operation and service endpoint.

(Inherited from WebHttpBehavior)
GetType()

Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
ToString()

Returns a string that represents the current object.

(Inherited from Object)
Validate(ServiceEndpoint)

Confirms that the endpoint meets the requirements that allow it to function as an ASP.NET AJAX endpoint.

ValidateBinding(ServiceEndpoint)

Ensures the binding is valid for use with the WCF Web Programming Model.

(Inherited from WebHttpBehavior)
ValidateOperation(OperationDescription) (Inherited from WebHttpBehavior)

Explicit Interface Implementations

IWmiInstanceProvider.FillInstance(IWmiInstance) (Inherited from WebHttpBehavior)
IWmiInstanceProvider.GetInstanceType() (Inherited from WebHttpBehavior)

Applies to