Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,83 +2,83 @@
description: "Learn more about: <add> Element for <namedCaches>"
title: "<add> Element for <namedCaches>"
ms.date: "03/30/2017"
helpviewer_keywords:
helpviewer_keywords:
- "add element for <namedCaches>"
- "<add> element for <namedCaches>"
ms.assetid: ce2a63a8-c829-4742-a6ea-72ee5d89f169
---
# \<add> Element for \<namedCaches>
# `<add>` Element for \<namedCaches>

Adds a `namedCache` entry to the `namedCaches` collection for a memory cache.

Adds a `namedCache` entry to the `namedCaches` collection for a memory cache.

[**\<configuration>**](../configuration-element.md)\
&nbsp;&nbsp;[**\<system.runtime.caching>**](system-runtime-caching-element-cache-settings.md)\
&nbsp;&nbsp;&nbsp;&nbsp;[**\<memoryCache>**](memorycache-element-cache-settings.md)\
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[**\<namedCaches>**](namedcaches-element-cache-settings.md)\
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;**\<add>**
## Syntax
```xml
<namedCaches>
<add name="Default" />
<!-- child elements -->
</namedCaches>
```
## Type

`None`
## Attributes and Elements

The following sections describe attributes, child elements, and parent elements.
### Attributes
|Attribute|Description|
|-|-|
|`CacheMemoryLimitMegabytes`|An integer value that specifies the maximum allowed size (in megabytes) that an instance of a <xref:System.Runtime.Caching.MemoryCache> can grow to. The default value is 0, which means that the <xref:System.Runtime.Caching.MemoryCache> class's autosizing heuristics are used by default.|
|`Name`|The name of the cache.|
|`PhysicalMemoryLimitPercentage`|An integer value between 0 and 100 that specifies the maximum percentage of physically installed computer memory that can be consumed by the cache. The default value is 0, which means that the <xref:System.Runtime.Caching.MemoryCache> class's autosizing heuristics are used by default.|
|`PollingInterval`|A value that indicates the time interval after which the cache implementation compares the current memory load against the absolute and percentage-based memory limits that are set for the cache instance. This value is entered in "HH:MM:SS" format.|
### Child Elements

`None`
### Parent Elements
|Element|Description|
|-------------|-----------------|
|[\<namedCaches>](namedcaches-element-cache-settings.md)|Contains a collection of configuration settings for the named <xref:System.Runtime.Caching.MemoryCache> instances.|
## Remarks

The `add` element adds an entry to the `namedCaches` collection for a memory cache. You can use the [clear](clear-element-for-namedcaches.md) element before you use the `add` element to be certain that there are no other named caches in the collection. This element can be used in the machine.config file and in the Web.config file.
## Example

The following example shows how to define settings for the default `namedCache` entry to the `namedCaches` collection for a memory cache.
```xml
<configuration>
<system.runtime.caching>
<memoryCache>
<namedCaches>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;**\<add>**

## Syntax

```xml
<namedCaches>
<add name="Default" />
<!-- child elements -->
</namedCaches>
```

## Type

`None`

## Attributes and Elements

The following sections describe attributes, child elements, and parent elements.

### Attributes

|Attribute|Description|
|-|-|
|`CacheMemoryLimitMegabytes`|An integer value that specifies the maximum allowed size (in megabytes) that an instance of a <xref:System.Runtime.Caching.MemoryCache> can grow to. The default value is 0, which means that the <xref:System.Runtime.Caching.MemoryCache> class's autosizing heuristics are used by default.|
|`Name`|The name of the cache.|
|`PhysicalMemoryLimitPercentage`|An integer value between 0 and 100 that specifies the maximum percentage of physically installed computer memory that can be consumed by the cache. The default value is 0, which means that the <xref:System.Runtime.Caching.MemoryCache> class's autosizing heuristics are used by default.|
|`PollingInterval`|A value that indicates the time interval after which the cache implementation compares the current memory load against the absolute and percentage-based memory limits that are set for the cache instance. This value is entered in "HH:MM:SS" format.|

### Child Elements

`None`

### Parent Elements

|Element|Description|
|-------------|-----------------|
|[\<namedCaches>](namedcaches-element-cache-settings.md)|Contains a collection of configuration settings for the named <xref:System.Runtime.Caching.MemoryCache> instances.|

## Remarks

The `add` element adds an entry to the `namedCaches` collection for a memory cache. You can use the [clear](clear-element-for-namedcaches.md) element before you use the `add` element to be certain that there are no other named caches in the collection. This element can be used in the machine.config file and in the Web.config file.

## Example

The following example shows how to define settings for the default `namedCache` entry to the `namedCaches` collection for a memory cache.

```xml
<configuration>

<system.runtime.caching>
<memoryCache>
<namedCaches>
<add name="Default"
cacheMemoryLimitMegabytes="0"
physicalMemoryPercentage="0"
pollingInterval="00:02:00" />
</namedCaches>
</memoryCache>
</system.runtime.caching>
</configuration>
```
physicalMemoryPercentage="0"
pollingInterval="00:02:00" />
</namedCaches>
</memoryCache>
</system.runtime.caching>

</configuration>
```

## See also

- [Configure apps by using configuration files](../../index.md)
- [\<namedCaches> Element (Cache Settings)](namedcaches-element-cache-settings.md)
- [`<namedCaches>` Element (Cache Settings)](namedcaches-element-cache-settings.md)
Original file line number Diff line number Diff line change
Expand Up @@ -2,114 +2,114 @@
description: "Learn more about: <alwaysFlowImpersonationPolicy> Element"
title: "<alwaysFlowImpersonationPolicy> Element"
ms.date: "03/30/2017"
f1_keywords:
f1_keywords:
- "http://schemas.microsoft.com/.NetConfiguration/v2.0#configuration/runtime/alwaysFlowImpersonationPolicy"
- "http://schemas.microsoft.com/.NetConfiguration/v2.0#alwaysFlowImpersonationPolicy"
helpviewer_keywords:
helpviewer_keywords:
- "alwaysFlowImpersonationPolicy element"
- "<alwaysFlowImpersonationPolicy> element"
ms.assetid: ee622801-9e46-470b-85ab-88c4b1dd2ee1
---
# \<alwaysFlowImpersonationPolicy> Element
# `<alwaysFlowImpersonationPolicy>` Element

Specifies that the Windows identity always flows across asynchronous points, regardless of how impersonation was performed.

Specifies that the Windows identity always flows across asynchronous points, regardless of how impersonation was performed.

[**\<configuration>**](../configuration-element.md)\
&nbsp;&nbsp;[**\<runtime>**](runtime-element.md)\
&nbsp;&nbsp;&nbsp;&nbsp;**\<alwaysFlowImpersonationPolicy>**
## Syntax
```xml

## Syntax

```xml
<alwaysFlowImpersonationPolicy
enabled="true|false"/>
```
## Attributes and Elements

The following sections describe attributes, child elements, and parent elements.
### Attributes
|Attribute|Description|
|---------------|-----------------|
|`enabled`|Required attribute.<br /><br /> Indicates whether the Windows identity flows across asynchronous points.|
## enabled Attribute
|Value|Description|
|-----------|-----------------|
|`false`|The Windows identity does not flow across asynchronous points, unless the impersonation is performed through managed methods such as <xref:System.Security.Principal.WindowsIdentity.Impersonate%2A>. This is the default.|
|`true`|The Windows identity always flows across asynchronous points, regardless of how impersonation was performed.|
### Child Elements

None.
### Parent Elements
|Element|Description|
|-------------|-----------------|
|`configuration`|The root element in every configuration file used by the common language runtime and .NET Framework applications.|
|`runtime`|Contains information about assembly binding and garbage collection.|
## Remarks

In the .NET Framework versions 1.0 and 1.1, the Windows identity does not flow across asynchronous points. In .NET Framework version 2.0, there is an <xref:System.Threading.ExecutionContext> object that contains information about the currently executing thread, and flows it across asynchronous points within an application domain. The <xref:System.Security.Principal.WindowsIdentity> also flows as part of the information that flows across the asynchronous points, provided the impersonation was achieved using managed methods such as <xref:System.Security.Principal.WindowsIdentity.Impersonate%2A> and not through other means such as platform invoke to native methods. This element is used to specify that the Windows identity does flow across asynchronous points, regardless of how the impersonation was achieved.
You can alter this default behavior in two other ways:
1. In managed code on a per-thread basis.
You can suppress the flow on a per-thread basis by modifying the <xref:System.Threading.ExecutionContext> and <xref:System.Security.SecurityContext> settings by using the <xref:System.Threading.ExecutionContext.SuppressFlow%2A?displayProperty=nameWithType>, <xref:System.Security.SecurityContext.SuppressFlowWindowsIdentity%2A?displayProperty=nameWithType>, or <xref:System.Security.SecurityContext.SuppressFlow%2A?displayProperty=nameWithType> method.
2. In the call to the unmanaged hosting interface to load the common language runtime (CLR).
If an unmanaged hosting interface (instead of a simple managed executable) is used to load the CLR, you can specify a special flag in the call to the [CorBindToRuntimeEx Function](../../../unmanaged-api/hosting/corbindtoruntimeex-function.md) function. To enable the compatibility mode for the entire process, set the `flags` parameter for [CorBindToRuntimeEx Function](../../../unmanaged-api/hosting/corbindtoruntimeex-function.md) to `STARTUP_ALWAYSFLOW_IMPERSONATION`.
## Configuration File

In a .NET Framework application, this element can be used only in the application configuration file.
For an ASP.NET application, the impersonation flow can be configured in the aspnet.config file found in the \<Windows Folder>\Microsoft.NET\Framework\vx.x.xxxx directory.
ASP.NET by default disables the impersonation flow in the aspnet.config file by using the following configuration settings:
enabled="true|false"/>
```

## Attributes and Elements

The following sections describe attributes, child elements, and parent elements.

### Attributes

|Attribute|Description|
|---------------|-----------------|
|`enabled`|Required attribute.<br /><br /> Indicates whether the Windows identity flows across asynchronous points.|

## enabled Attribute

|Value|Description|
|-----------|-----------------|
|`false`|The Windows identity does not flow across asynchronous points, unless the impersonation is performed through managed methods such as <xref:System.Security.Principal.WindowsIdentity.Impersonate%2A>. This is the default.|
|`true`|The Windows identity always flows across asynchronous points, regardless of how impersonation was performed.|

### Child Elements

None.

### Parent Elements

|Element|Description|
|-------------|-----------------|
|`configuration`|The root element in every configuration file used by the common language runtime and .NET Framework applications.|
|`runtime`|Contains information about assembly binding and garbage collection.|

## Remarks

In the .NET Framework versions 1.0 and 1.1, the Windows identity does not flow across asynchronous points. In .NET Framework version 2.0, there is an <xref:System.Threading.ExecutionContext> object that contains information about the currently executing thread, and flows it across asynchronous points within an application domain. The <xref:System.Security.Principal.WindowsIdentity> also flows as part of the information that flows across the asynchronous points, provided the impersonation was achieved using managed methods such as <xref:System.Security.Principal.WindowsIdentity.Impersonate%2A> and not through other means such as platform invoke to native methods. This element is used to specify that the Windows identity does flow across asynchronous points, regardless of how the impersonation was achieved.

You can alter this default behavior in two other ways:

1. In managed code on a per-thread basis.

You can suppress the flow on a per-thread basis by modifying the <xref:System.Threading.ExecutionContext> and <xref:System.Security.SecurityContext> settings by using the <xref:System.Threading.ExecutionContext.SuppressFlow%2A?displayProperty=nameWithType>, <xref:System.Security.SecurityContext.SuppressFlowWindowsIdentity%2A?displayProperty=nameWithType>, or <xref:System.Security.SecurityContext.SuppressFlow%2A?displayProperty=nameWithType> method.

2. In the call to the unmanaged hosting interface to load the common language runtime (CLR).

If an unmanaged hosting interface (instead of a simple managed executable) is used to load the CLR, you can specify a special flag in the call to the [CorBindToRuntimeEx Function](../../../unmanaged-api/hosting/corbindtoruntimeex-function.md) function. To enable the compatibility mode for the entire process, set the `flags` parameter for [CorBindToRuntimeEx Function](../../../unmanaged-api/hosting/corbindtoruntimeex-function.md) to `STARTUP_ALWAYSFLOW_IMPERSONATION`.

## Configuration File

In a .NET Framework application, this element can be used only in the application configuration file.

For an ASP.NET application, the impersonation flow can be configured in the aspnet.config file found in the \<Windows Folder>\Microsoft.NET\Framework\vx.x.xxxx directory.

ASP.NET by default disables the impersonation flow in the aspnet.config file by using the following configuration settings:

```xml
<configuration>
<runtime>
<legacyImpersonationPolicy enabled="true"/>
<alwaysFlowImpersonationPolicy enabled="false"/>
</runtime>
</configuration>
```
In ASP.NET, if you want to allow the flow of impersonation instead, you must explicitly use the following configuration settings:
```xml
<configuration>
<runtime>
<legacyImpersonationPolicy enabled="false"/>
<alwaysFlowImpersonationPolicy enabled="true"/>
</runtime>
</configuration>
```
## Example

The following example shows how to specify that the Windows identity flows across asynchronous points, even when the impersonation is achieved through means other than managed methods.
```xml
<configuration>
<runtime>
<alwaysFlowImpersonationPolicy enabled="true"/>
</runtime>
</configuration>
```
<configuration>
<runtime>
<legacyImpersonationPolicy enabled="true"/>
<alwaysFlowImpersonationPolicy enabled="false"/>
</runtime>
</configuration>
```

In ASP.NET, if you want to allow the flow of impersonation instead, you must explicitly use the following configuration settings:

```xml
<configuration>
<runtime>
<legacyImpersonationPolicy enabled="false"/>
<alwaysFlowImpersonationPolicy enabled="true"/>
</runtime>
</configuration>
```

## Example

The following example shows how to specify that the Windows identity flows across asynchronous points, even when the impersonation is achieved through means other than managed methods.

```xml
<configuration>
<runtime>
<alwaysFlowImpersonationPolicy enabled="true"/>
</runtime>
</configuration>
```

## See also

- [Configure apps by using configuration files](../../index.md)
- [Runtime Settings Schema](index.md)
- [Configuration File Schema](../index.md)
- [\<legacyImpersonationPolicy> Element](legacyimpersonationpolicy-element.md)
- [`<legacyImpersonationPolicy>` Element](legacyimpersonationpolicy-element.md)
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ helpviewer_keywords:
- "configuration"
ms.assetid: 4ce07f47-7ddb-4d91-b067-501bd8b88752
---
# \<AppContextSwitchOverrides> element
# `<AppContextSwitchOverrides>` element

Defines one or more switches used by the <xref:System.AppContext> class to provide an opt-out mechanism for new functionality.

Expand Down Expand Up @@ -182,5 +182,5 @@ The following example uses the `<add>` element to add two settings to the `<appS
- [Configure apps by using configuration files](../../index.md)
- [Mitigate new behaviors in .NET Framework 4.6 and later](../../../migration-guide/mitigations.md)
- <xref:System.AppContext?displayProperty=nameWithType>
- [\<runtime> Element](runtime-element.md)
- [\<configuration> Element](../configuration-element.md)
- [`<runtime>` Element](runtime-element.md)
- [`<configuration>` Element](../configuration-element.md)
Loading
Loading