Performance issue when you use WCF to send XML SOAP messages in the .NET Framework 4.6

Symptoms

Assume that you have upgraded to Microsoft .NET Framework 4.6 on your computer. When you use an application that uses Windows Communication Framework (WCF) to send XML SOAP messages, the encoding may take slightly longer. In some cases, this might affect the rate at which a server application can process requests.

Cause

This issue occurs because of a new Just-In-Time (JIT) compiler that is named RyuJIT. This compiler uses different optimizations than the legacy JIT64 compiler. A method on a hot code path for encoding strings in the XmlDictionaryWriter is not optimized for the new JIT compiler and the generated native instructions run slower and the encoding takes longer. When a SOAP message contains a large number of strings to be encoded, this slower code is used more frequently and may affect the encoding time.

Resolution

To work around this issue, configure the application to disable the use of ngen for the System.Runtime.Serialization.dll assembly and to use the legacy JIT engine. To do this, use one of the following methods:
  • Set the following environment variables:

    COMPLUS_useLegacyJit=1
    COMPLUS_DisableNativeImageLoadList=System.Runtime.Serialization
  • In the registry, create either of the following subkeys:

    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework
    HKEY_CURRENT_USER\SOFTWARE\Microsoft\.NETFramework

    Then, add the following values:
    • Key name: useLegacyJit
      Type: REG_WORD
      Value: 1
    • Key name: DisableNativeImageLoadList
      Type: REG_SZ   
      Value: System.Runtime.Serialization
  • Add the following text to the <app>.exe.config file . Create the indicated sections if they do not already exist.
    <configuration>
    <runtime>
    <useLegacyJit enabled="1">
    <disableNativeImageLoad>
    <assemblyIdentity name="System.Runtime.Serialization" />
    </disableNativeImageLoad>
    </runtime>
    </configuration>


For more information about the known issues in the .NET Framework 4.6, see Known issues for the .NET Framework 4.6 .

More Information

For more information about the product versioning changes and their effects in the .NET Framework 4.6, see Application Compatibility in the .NET Framework 4.6.
Properties

Article ID: 3076436 - Last Review: Jul 20, 2015 - Revision: 1

Feedback