Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

ServiceHostFactory.CreateServiceHost Method (String, Uri[])

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

Namespace: System.ServiceModel.Activation
Assembly: System.ServiceModel (in system.servicemodel.dll)

public override ServiceHostBase CreateServiceHost (
	string constructorString,
	Uri[] baseAddresses
)
public ServiceHostBase CreateServiceHost (
	String constructorString, 
	Uri[] baseAddresses
)
public override function CreateServiceHost (
	constructorString : String, 
	baseAddresses : Uri[]
) : ServiceHostBase
Not applicable.

Parameters

constructorString

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

baseAddresses

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

Return Value

A ServiceHost with specific base addresses.

Exception typeCondition

ArgumentNullException

baseAddress is a null reference (Nothing in Visual Basic).

InvalidOperationException

There is no hosting context provided or constructorString is a null reference (Nothing in Visual Basic) or empty.

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;

}

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0

Community Additions

ADD
Show:
© 2015 Microsoft