Muokkaa

Jaa


ServiceHostFactory.CreateServiceHost Method

Definition

Creates a ServiceHost.

Overloads

CreateServiceHost(String, Uri[])

Creates a ServiceHost with specific base addresses and initializes it with specified data.

CreateServiceHost(Type, Uri[])

Creates a ServiceHost for a specified type of service with a specific base address.

CreateServiceHost(String, Uri[])

Creates a ServiceHost with specific base addresses and initializes it with specified data.

public:
 override System::ServiceModel::ServiceHostBase ^ CreateServiceHost(System::String ^ constructorString, cli::array <Uri ^> ^ baseAddresses);
public override System.ServiceModel.ServiceHostBase CreateServiceHost (string constructorString, Uri[] baseAddresses);
override this.CreateServiceHost : string * Uri[] -> System.ServiceModel.ServiceHostBase
Public Overrides Function CreateServiceHost (constructorString As String, baseAddresses As Uri()) As ServiceHostBase

Parameters

constructorString
String

The initialization data passed to the ServiceHostBase instance being constructed by the factory.

baseAddresses
Uri[]

The Array of type Uri that contains the base addresses for the service hosted.

Returns

A ServiceHost with specific base addresses.

Exceptions

baseAddress is null.

There is no hosting context provided or constructorString is null or empty.

Examples

This example shows how to use the CreateServiceHost(String, Uri[]) method:

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;
}
Public Overrides Overloads Function CreateServiceHost(ByVal service As String, ByVal baseAddresses() As Uri) As ServiceHostBase


    ' The service parameter is ignored here because we know our service.
    Dim serviceHost As New ServiceHost(GetType(HelloService), baseAddresses)
    Return serviceHost

End Function

Applies to

CreateServiceHost(Type, Uri[])

Creates a ServiceHost for a specified type of service with a specific base address.

protected:
 virtual System::ServiceModel::ServiceHost ^ CreateServiceHost(Type ^ serviceType, cli::array <Uri ^> ^ baseAddresses);
protected virtual System.ServiceModel.ServiceHost CreateServiceHost (Type serviceType, Uri[] baseAddresses);
override this.CreateServiceHost : Type * Uri[] -> System.ServiceModel.ServiceHost
Protected Overridable Function CreateServiceHost (serviceType As Type, baseAddresses As Uri()) As ServiceHost

Parameters

serviceType
Type

Specifies the type of service to host.

baseAddresses
Uri[]

The Array of type Uri that contains the base addresses for the service hosted.

Returns

A ServiceHost for the type of service specified with a specific base address.

Examples

This example shows how to create an override implementation of the CreateServiceHost(Type, Uri[]) method:

Applies to