Export (0) Print
Expand All

ServiceContractAttribute.ProtectionLevel Property

Specifies whether the binding for the contract must support the value of the ProtectionLevel property.

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

public:
property ProtectionLevel ProtectionLevel {
	ProtectionLevel get ();
	void set (ProtectionLevel value);
}
/** @property */
public ProtectionLevel get_ProtectionLevel ()

/** @property */
public void set_ProtectionLevel (ProtectionLevel value)

public function get ProtectionLevel () : ProtectionLevel

public function set ProtectionLevel (value : ProtectionLevel)

Not applicable.

Property Value

One of the System.Net.Security.ProtectionLevel values. The default is System.Net.Security.ProtectionLevel.None.

Exception typeCondition

ArgumentOutOfRangeException

The value is not one of the System.Net.Security.ProtectionLevel values.

Use the ProtectionLevel property to specify the degree to which the contract binding requires encryption, digital signatures, or both for endpoints that expose the contract. The value set here is the default value for all operation messages including faults.

It is important to remember that the protection behavior at runtime is the combination of the protection-level values set on the following properties. These properties have a hierarchical structure. Setting the outermost value establishes the default setting for all narrower scopes unless a different value for a narrower scope is explicitly set. In this case, the outer value remains the default for all narrower scopes with the exception of that specifically set.

For example, if ServiceContractAttribute.ProtectionLevel is set to System.Net.Security.ProtectionLevel.EncryptAndSign and no other narrower scopes have protection level settings, all messages in an operation contract are encrypted and signed. If, however, one of those operations has the OperationContractAttribute set to System.Net.Security.ProtectionLevel.Sign, then the messages for that operation are signed but all other messages in the contract are encrypted and signed.

For details about protection levels and their assumptions and scopes, see Understanding Protection Level.

The scopes at which these values are set are:

ServiceContractAttribute.ProtectionLevel

    OperationContractAttribute.ProtectionLevel

        FaultContractAttribute.ProtectionLevel

        MessageContractAttribute.ProtectionLevel

            The MessageContractMemberAttribute.ProtectionLevel property on System.ServiceModel.MessageHeaderAttribute.

            The MessageContractMemberAttribute.ProtectionLevel property on System.ServiceModel.MessageBodyMemberAttribute.

When there is no protection level explicitly specified on the contract and the underlying binding supports security (whether at the transport or message level), the effective protection level for the whole contract is System.Net.Security.ProtectionLevel.EncryptAndSign. If the binding does not support security (such as BasicHttpBinding), the effective System.Net.Security.ProtectionLevel is System.Net.Security.ProtectionLevel.None for the whole contract. The result is that depending upon the endpoint binding, clients can require different message or transport level security protection even when the contract specifies System.Net.Security.ProtectionLevel.None.

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

Community Additions

ADD
Show:
© 2014 Microsoft