This element defines the type the service hosting environment instantiates for a particular transport. If this element is empty, the default type is used.

Schema Hierarchy



                <add prefix="string"/>
        <add name="String" 
             transportConfigurationType="String" />

Attributes and Elements

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


Attribute Description


A Boolean value indicating whether the ASP.NET compatibility mode has been turned on for the current application. The default is false.

When this attribute is set to true, requests to Windows Communication Foundation (WCF) services flow through the ASP.NET HTTP pipeline, and communication over non-HTTP protocols is prohibited. For more information, see WCF Services and ASP.NET.


An integer that specifies the minimum amount of free memory that should be available to the system, before a WCF service can be activated.

Specifying this attribute along with partial trust in the web.config file of a WCF service will result in a SecurityException when the service is run.

Child Elements

Element Description


A collection of configuration elements that specify prefix filters for the base addresses used by the service host.


A collection of configuration elements that identify the type of a particular transport.

Parent Elements

Element Description


The root element of all Windows Communication Foundation (WCF) configuration elements.


By default, WCF services run side-by-side with ASP.NET in hosted Application Domains (AppDomain). Even though WCF and ASP.NET can coexist in the same AppDomain, WCF requests are not processed by the ASP.NET HTTP Pipeline by default. As a result, several elements of the ASP.NET application platform are not available to WCF services. These include

  • ASP.NET File/URL Authorization

  • ASP.NET Impersonation

  • Cookie-based Session State

  • HttpContext.Current

  • Pipeline Extensibility via custom HttpModule

If your WCF services need to function in the ASP.NET context, and communicate only over HTTP, you can use WCF’s ASP.NET compatibility mode. This mode is turned on when the aspNetCompatibilityEnabled attribute is set to true at the application level. Service implementations must declare their ability to run in compatibility mode using the AspNetCompatibilityRequirementsAttribute class. When the compatibility mode is enabled,

  • ASP.NET File/URL Authorization is enforced prior to WCF authorization. An authorization decision is based on the transport-level identity of the request. Identities at the message level are ignored.

  • WCF service operations start to execute in the ASP.NET impersonation context. If both ASP.NET impersonation and WCF impersonation are enabled for a specific service, the WCF impersonation context applies.

  • HttpContext.Current can be used from WCF service code, and services are prevented from exposing non-HTTP endpoints.

  • WCF requests are processed by the ASP.NET pipeline. HttpModules that have been configured to act on incoming requests can also process WCF requests. These can include ASP.NET platform components (e.g., SessionStateModule), as well as custom third party modules.


The following code sample shows how to enable ASP Compatibility Mode.


<serviceHostingEnvironment aspNetCompatibilityEnabled="true"/>

See Also



Other Resources

WCF Services and ASP.NET

© 2007 Microsoft Corporation. All rights reserved.
Last Published: 2010-01-05