This documentation is archived and is not being maintained.

ServiceHostingEnvironment.EnsureServiceAvailable Method

Ensures that a service is activated at the provided virtual path.

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

public static void EnsureServiceAvailable (
	string virtualPath
public static void EnsureServiceAvailable (
	String virtualPath
public static function EnsureServiceAvailable (
	virtualPath : String
Not applicable.



The virtual path to the service.

Exception typeCondition


A service at given virtual path cannot be found.


The service fails to activate successfully.


The service is not running in the hosted environment.


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


virtualPath is an absolute URI or not valid.

This method is used by third-party transport developers to activate the service at the provided virtual path if that service is not already active. This method is idempotent so that once it has been called, calling it again with the same virtualPath specified is safe in the sense that it has no effect.

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