Factory that provides instances of ServiceHost in managed hosting environments where the host instance is created dynamically in response to incoming messages.
Namespace:
System.ServiceModel.Activation
Assembly:
System.ServiceModel (in System.ServiceModel.dll)
Visual Basic (Declaration)
Public Class ServiceHostFactory _
Inherits ServiceHostFactoryBase
Dim instance As ServiceHostFactory
public class ServiceHostFactory : ServiceHostFactoryBase
public ref class ServiceHostFactory : public ServiceHostFactoryBase
public class ServiceHostFactory extends ServiceHostFactoryBase
The managed hosting environments that support dynamic activation are Internet Information Services (IIS) and Windows Process Activation Service (WAS).
If you have implemented a custom derivative of ServiceHost, consider also implementing a factory that derives from the ServiceHostFactory class.
If you have implemented a custom derivative of ServiceHostBase instead, then consider also implementing a factory that derives your factory from ServiceHostFactoryBase directly.
This examples show how to use the ServiceHostFactory class:
public class DerivedFactory : ServiceHostFactory
{
protected override ServiceHost CreateServiceHost( Type t, Uri[] baseAddresses )
{
return new DerivedHost( t, baseAddresses );
}
//Then in the CreateServiceHost method, we can do all of the
//things that we can do in a self-hosted case:
public override ServiceHostBase CreateServiceHost
(string service, Uri[] baseAddresses)
{
// The service parameter is ignored here because we know our service.
ServiceHost serviceHost = new ServiceHost(typeof(HelloService),
baseAddresses);
return serviceHost;
}
}
System..::.Object
System.ServiceModel.Activation..::.ServiceHostFactoryBase
System.ServiceModel.Activation..::.ServiceHostFactory
System.ServiceModel.Activation..::.WebScriptServiceHostFactory
System.ServiceModel.Activation..::.WebServiceHostFactory
System.Web.ApplicationServices..::.ApplicationServicesHostFactory
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
.NET Framework
Supported in: 3.5, 3.0
Reference