CreateServiceHost Method (String, Uri[])
Collapse the table of content
Expand the table of content

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.Activation (in System.ServiceModel.Activation.dll)

Public Overrides Function CreateServiceHost (
	constructorString As String,
	baseAddresses As Uri()
) As ServiceHostBase


Type: System.String

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

Type: System.Uri()

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

Return Value

Type: System.ServiceModel.ServiceHostBase

A ServiceHost with specific base addresses.

Exception Condition

baseAddress is null.


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

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

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

.NET Framework
Available since 3.0
Return to top
© 2016 Microsoft