WebServiceHost 构造函数

定义

初始化 WebServiceHost 类的新实例。

重载

WebServiceHost()

初始化 WebServiceHost 类的新实例。

WebServiceHost(Object, Uri[])

使用指定的单一服务器实例和基址初始化 WebServiceHost 类的新实例。

WebServiceHost(Type, Uri[])

使用指定的服务类型和基址初始化 WebServiceHost 类的新实例。

WebServiceHost()

初始化 WebServiceHost 类的新实例。

public:
 WebServiceHost();
public WebServiceHost ();
Public Sub New ()

适用于

WebServiceHost(Object, Uri[])

使用指定的单一服务器实例和基址初始化 WebServiceHost 类的新实例。

public:
 WebServiceHost(System::Object ^ singletonInstance, ... cli::array <Uri ^> ^ baseAddresses);
public WebServiceHost (object singletonInstance, params Uri[] baseAddresses);
new System.ServiceModel.Web.WebServiceHost : obj * Uri[] -> System.ServiceModel.Web.WebServiceHost
Public Sub New (singletonInstance As Object, ParamArray baseAddresses As Uri())

参数

singletonInstance
Object

要用作单一实例的服务实例。

baseAddresses
Uri[]

服务的基址。

示例

下面的示例演示如何调用此构造函数。

Uri[] baseAddresses = { new Uri("http://localhost/one"), new Uri("http://localhost/two") };
object mySingleton = GetObject();
WebServiceHost host = new WebServiceHost(mySingleton, baseAddresses);
Dim baseAddresses() As Uri = {New Uri("http://localhost/one"), New Uri("http://localhost/two")}
Dim mySingleton As Object = GetObject()
Dim host As WebServiceHost = New WebServiceHost(mySingleton, baseAddresses)

注解

baseAddresses 参数可包含一个或多个基址。

适用于

WebServiceHost(Type, Uri[])

使用指定的服务类型和基址初始化 WebServiceHost 类的新实例。

public:
 WebServiceHost(Type ^ serviceType, ... cli::array <Uri ^> ^ baseAddresses);
public WebServiceHost (Type serviceType, params Uri[] baseAddresses);
new System.ServiceModel.Web.WebServiceHost : Type * Uri[] -> System.ServiceModel.Web.WebServiceHost
Public Sub New (serviceType As Type, ParamArray baseAddresses As Uri())

参数

serviceType
Type

服务类型。

baseAddresses
Uri[]

服务的基址。

示例

下面的示例演示如何调用此构造函数。

Uri[] baseAddresses = { new Uri("http://localhost/one"), new Uri("http://localhost/two") };
WebServiceHost host = new WebServiceHost(typeof(CalcService), baseAddresses);
Dim baseAddresses() As Uri = {New Uri("http://localhost/one"), New Uri("http://localhost/two")}
Dim host As WebServiceHost = New WebServiceHost(GetType(CalcService), baseAddresses)

注解

baseAddresses 参数可包含一个或多个基址。

适用于