WebScriptEnablingBehavior Class

 

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.

Namespace:   System.ServiceModel.Description
Assembly:  System.ServiceModel.Web (in System.ServiceModel.Web.dll)

System.Object
  System.ServiceModel.Description.WebHttpBehavior
    System.ServiceModel.Description.WebScriptEnablingBehavior

public sealed class WebScriptEnablingBehavior : WebHttpBehavior

NameDescription
System_CAPS_pubmethodWebScriptEnablingBehavior()

Initializes a new instance of the WebScriptEnablingBehavior class.

NameDescription
System_CAPS_pubpropertyAutomaticFormatSelectionEnabled

Gets or sets a value that determines if automatic format selection is enabled.(Overrides WebHttpBehavior.AutomaticFormatSelectionEnabled.)

System_CAPS_pubpropertyDefaultBodyStyle

Gets or sets the default message body style.(Overrides WebHttpBehavior.DefaultBodyStyle.)

System_CAPS_pubpropertyDefaultOutgoingRequestFormat

Gets or sets the default outgoing request message format.(Overrides WebHttpBehavior.DefaultOutgoingRequestFormat.)

System_CAPS_pubpropertyDefaultOutgoingResponseFormat

Gets and sets the default outgoing response message format.(Overrides WebHttpBehavior.DefaultOutgoingResponseFormat.)

System_CAPS_pubpropertyFaultExceptionEnabled

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

System_CAPS_pubpropertyHelpEnabled

Gets or sets a value that determines if the WCF REST Help page is enabled.(Overrides WebHttpBehavior.HelpEnabled.)

System_CAPS_protpropertyJavascriptCallbackParameterName

Gets or sets the JavaScript callback parameter name.(Inherited from WebHttpBehavior.)

NameDescription
System_CAPS_pubmethodAddBindingParameters(ServiceEndpoint, BindingParameterCollection)

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

System_CAPS_pubmethodApplyClientBehavior(ServiceEndpoint, ClientRuntime)

Applies the behavior to the client across an endpoint.(Overrides WebHttpBehavior.ApplyClientBehavior(ServiceEndpoint, ClientRuntime).)

System_CAPS_pubmethodApplyDispatchBehavior(ServiceEndpoint, EndpointDispatcher)

Applies the behavior to the service endpoint.(Overrides WebHttpBehavior.ApplyDispatchBehavior(ServiceEndpoint, EndpointDispatcher).)

System_CAPS_pubmethodEquals(Object)

Determines whether the specified object is equal to the current object.(Inherited from Object.)

System_CAPS_pubmethodGetHashCode()

Serves as the default hash function. (Inherited from Object.)

System_CAPS_pubmethodGetType()

Gets the Type of the current instance.(Inherited from Object.)

System_CAPS_pubmethodToString()

Returns a string that represents the current object.(Inherited from Object.)

System_CAPS_pubmethodValidate(ServiceEndpoint)

Confirms that the endpoint meets the requirements that allow it to function as an ASP.NET AJAX endpoint.(Overrides WebHttpBehavior.Validate(ServiceEndpoint).)

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.

.NET Framework
Available since 3.5

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top
Show: