Export (0) Print
Expand All

WebScriptServiceHostFactory Class

Automatically adds an ASP.NET AJAX endpoint to a service, without requiring configuration, in a managed hosting environment that dynamically activates host instances for the service in response to incoming messages.

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

public class WebScriptServiceHostFactory : ServiceHostFactory

The WebScriptServiceHostFactory type exposes the following members.

  NameDescription
Public methodWebScriptServiceHostFactoryInitializes a new instance of the WebScriptServiceHostFactory class.
Top

  NameDescription
Public methodCreateServiceHost(String, Uri[])Creates a ServiceHost with specific base addresses and initializes it with specified data. (Inherited from ServiceHostFactory.)
Protected methodCreateServiceHost(Type, Uri[])Creates a derived class of ServiceHost for a specified type of service with a specific base address that can be used to automatically enable ASP.NET AJAX endpoints in certain scenarios. (Overrides ServiceHostFactory.CreateServiceHost(Type, Uri[]).)
Public methodEquals(Object)Determines whether the specified object is equal to the current object. (Inherited from Object.)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public methodGetHashCodeServes as the default hash function. (Inherited from Object.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)
Top

This factory provides a way to add an ASP.NET AJAX endpoint to a service without requiring configuration. The endpoint is added to any other endpoints that are defined in configuration, if any. The managed hosting environments that support this type of dynamic host activation are Internet Information Services (IIS) and Windows Process Activation Services (WAS).

To use this factory, specify the WebScriptServiceHostFactory in the Factory attribute of the @ServiceHost directive.

The ASP.NET AJAX endpoint created by this factory is configured with the WebHttpBinding and the WebScriptEnablingBehavior, with all the default settings. The endpoint is created at an empty address relative to the .svc file. If service configuration already defines an endpoint at this address, an InvalidOperationException is thrown and the service fails to start.

Specify the WebScriptServiceHostFactory for the value of the Factory attribute in the @ServiceHost directive to activate an ASP.NET AJAX endpoint for the MyService service as shown in the following example.

<% @ServiceHost 
Service="MyService"
Language="C#"
Debug="true"
Factory="WebScriptServiceHostFactory"
%>

.NET Framework

Supported in: 4.5, 4, 3.5

.NET Framework Client Profile

Supported in: 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

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