WebScriptServiceHostFactory.CreateServiceHost(Type, Uri[]) 方法

定义

为具有特定基址的指定类型的服务创建 ServiceHost 的派生类,在某些情况下可使用该服务来自动启用 ASP.NET AJAX 终结点。Creates a derived class of ServiceHost for a specified type of service with a specific base address that can be used to automatically enable ASP.NET AJAX endpoints in certain scenarios.

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

参数

serviceType
Type

要承载的服务的类型。The type of service to host.

baseAddresses
Uri[]

类型为 Array 且包含所承载服务的基址的 UriThe Array of type Uri that contains the base addresses for the service hosted.

返回

ServiceHost

使用指定基址指定的该类型服务的 ServiceHostA ServiceHost for the type of service specified with the specified base address.

例外

另一个服务使用相同的基址,或另一个终结点正在使用与此工厂试图创建的 ASP.NET AJAX 终结点相同的地址。Another service uses the same base address, or another endpoint is using the same address as the ASP.NET AJAX endpoint that this factory is trying to create.

注解

通常,Windows Communication Foundation (WCF)在服务激活过程中自动调用此方法-无需手动调用此方法。Normally, this method is called automatically by Windows Communication Foundation (WCF) as part of service activation - there is no need to call this method manually.

适用于