ImpersonationOption ImpersonationOption ImpersonationOption ImpersonationOption Enum

定義

サービス インスタンスのサービス操作の偽装動作を指定します。Specifies the impersonation behavior for a service operation on a service instance.

public enum class ImpersonationOption
public enum ImpersonationOption
type ImpersonationOption = 
Public Enum ImpersonationOption
継承
ImpersonationOptionImpersonationOptionImpersonationOptionImpersonationOption

フィールド

Allowed Allowed Allowed Allowed 1

偽装は、資格情報が使用可能であり、ImpersonateCallerForAllOperationstrue の場合に実行されます。Impersonation is performed if credentials are available and ImpersonateCallerForAllOperations is equal to true.

NotAllowed NotAllowed NotAllowed NotAllowed 0

偽装は実行されません。Impersonation is not performed. ImpersonateCallerForAllOperationstrue の場合、サービスの起動時に検証例外が発生します。If ImpersonateCallerForAllOperations is equal to true, a validation exception occurs at service startup time.

Required Required Required Required 2

偽装する必要があります。Impersonation is required.

サービスに関する次のコード例は、OperationBehaviorAttribute を使用して偽装レベルを設定することで、メソッドに呼び出し元を偽装させる方法を示しています。The following code example on the service shows how to have a method impersonate the caller by using the OperationBehaviorAttribute to set the impersonation level.

[OperationBehavior(Impersonation = ImpersonationOption.Required)]
public double Add(double n1, double n2)
{
    double result = n1 + n2;
    Console.WriteLine("Received Add({0},{1})", n1, n2);
    Console.WriteLine("Return: {0}", result);
    DisplayIdentityInformation();
    return result;
}
<OperationBehavior(Impersonation := ImpersonationOption.Required)> _
Public Function Add(ByVal n1 As Double, ByVal n2 As Double) As Double Implements ICalculator.Add
    Dim result = n1 + n2
    Console.WriteLine("Received Add({0},{1})", n1, n2)
    Console.WriteLine("Return: {0}", result)
    DisplayIdentityInformation()
    Return result
End Function

注釈

列挙体ImpersonationOptionを使用して、Windows Communication Foundation (WCF) アプリケーションの偽装を制御します。Use the ImpersonationOption enumeration to control impersonation in Windows Communication Foundation (WCF) applications.

この設定は、次の表に示す ImpersonateCallerForAllOperations の構成プロパティと相互関係があります。This setting interacts with a configuration property on ImpersonateCallerForAllOperations in the following table.

適用対象