title: WCF aspNetCompatibilityEnabled="true" raise an exception (failed to load)
body: <p>I need to have sessions enables in my WCF service.
  so I have to:</p>
  
  <pre><code>&lt;serviceHostingEnvironment aspNetCompatibilityEnabled="true"/&gt;
  </code></pre>
  
  <p>When I do that I get an exception:</p>
  
  <blockquote>
    <p>The service cannot be activated because it does not support ASP.NET
    compatibility. ASP.NET compatibility is enabled for this application.
    Turn off ASP.NET compatibility mode in the web.config or add the
    AspNetCompatibilityRequirements attribute to the service type with
    RequirementsMode setting as 'Allowed' or 'Required'</p>
  </blockquote>
  
  <p>This is my web.config:</p>
  
  <p></p>
  
  <pre><code>&lt;compilation debug="true"&gt;
    &lt;assemblies&gt;
      &lt;add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/&gt;
      &lt;add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/&gt;
    &lt;/assemblies&gt;
  &lt;/compilation&gt;
  </code></pre>
  
  <p></p>
  
  <p>
      
        
          
          
        
      
    </p>
  
  <p>
    </p>
  
  <p></p>
  
  <pre><code>&lt;services&gt;
    &lt;service behaviorConfiguration="ExecutionEngine.AccountsBehavior" name="WebService.Services.Accounts"&gt;
      &lt;endpoint address="" binding="wsHttpBinding" contract="WebService.Services.IAccounts" bindingConfiguration="SafeServiceConf"&gt;
        &lt;identity&gt;
          &lt;dns value="localhost"/&gt;
        &lt;/identity&gt;
      &lt;/endpoint&gt;
      &lt;endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange"/&gt;
    &lt;/service&gt;
  &lt;/services&gt;
  
  
  
  &lt;behaviors&gt;
    &lt;serviceBehaviors&gt;
      &lt;behavior name="defaultBehavior"&gt;
        &lt;serviceDebug includeExceptionDetailInFaults="true" /&gt;
        &lt;serviceMetadata httpGetEnabled="true" /&gt;
      &lt;/behavior&gt;
      &lt;behavior name=""&gt;
        &lt;serviceMetadata httpGetEnabled="true" /&gt;
        &lt;serviceDebug includeExceptionDetailInFaults="false" /&gt;
      &lt;/behavior&gt;
      &lt;behavior name="ExecutionEngine.AccountsBehavior"&gt;
        &lt;serviceMetadata httpGetEnabled="true"/&gt;
        &lt;serviceDebug includeExceptionDetailInFaults="true" /&gt;
        &lt;serviceCredentials&gt;
          &lt;userNameAuthentication
               userNamePasswordValidationMode="Custom"
               customUserNamePasswordValidatorType="WebService.Services.Security.CustomValidator,WebService" /&gt;
        &lt;/serviceCredentials&gt;
      &lt;/behavior&gt;
    &lt;/serviceBehaviors&gt;
  &lt;/behaviors&gt;
  
  
  
  &lt;bindings&gt;
  
  
  
  
  
    &lt;wsHttpBinding&gt;
      &lt;binding name="SafeServiceConf" maxReceivedMessageSize="65536"&gt;
        &lt;readerQuotas maxStringContentLength="65536" maxArrayLength="65536"
           maxBytesPerRead="65536" /&gt;
        &lt;security mode="TransportWithMessageCredential"&gt;
          &lt;message clientCredentialType="UserName" /&gt;
        &lt;/security&gt;
      &lt;/binding&gt;
      &lt;binding name="CrmServiceEndpoint" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false"&gt;
        &lt;readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" /&gt;
        &lt;reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false" /&gt;
        &lt;security mode="Message"&gt;
          &lt;transport clientCredentialType="Windows" proxyCredentialType="None" realm="" /&gt;
          &lt;message clientCredentialType="Certificate" negotiateServiceCredential="false" algorithmSuite="Default" establishSecurityContext="false" /&gt;
        &lt;/security&gt;
      &lt;/binding&gt;
      &lt;binding name="CrmServiceEndpointSSL" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false"&gt;
        &lt;readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" /&gt;
        &lt;reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false" /&gt;
        &lt;security mode="TransportWithMessageCredential"&gt;
          &lt;transport clientCredentialType="None" proxyCredentialType="None" realm="" /&gt;
          &lt;message clientCredentialType="Certificate" negotiateServiceCredential="true" algorithmSuite="Default" establishSecurityContext="false" /&gt;
        &lt;/security&gt;
      &lt;/binding&gt;
    &lt;/wsHttpBinding&gt;
  
  &lt;/bindings&gt;
  
  
  &lt;serviceHostingEnvironment aspNetCompatibilityEnabled="true"/&gt;
  </code></pre>
  
  <p></p>