ServiceBehaviorAttribute.SetWellKnownSingleton(Object) 方法

定义

指定实现此服务的对象,该对象被用作服务的单一实例。Specifies an object that implements the service and that is used as the singleton instance of the service.

public:
 void SetWellKnownSingleton(System::Object ^ value);
public void SetWellKnownSingleton (object value);
member this.SetWellKnownSingleton : obj -> unit
Public Sub SetWellKnownSingleton (value As Object)

参数

value
Object

服务的单一实例。The singleton instance of the service.

例外

该值设置为 nullThe value set is null.

注解

这会提供服务实例,所有定址到该服务的消息都将调度到此实例。This provides the service instance to which all messages addressed to the service will be dispatched.

如果 SetWellKnownSingleton 设置为非 null 值,则 InstanceContextMode 必须设置为 Single,否则将引发 InvalidOperationExceptionIf SetWellKnownSingleton is set to a non-null value, then the InstanceContextMode must be set to Single or an InvalidOperationException is thrown.

适用于