title: An existing connection was forcibly closed by the remote host Error after .Net 4.0 upgrade from .Net 3.5
body: <p>Hi I recently upgraded my WPF client and WCF services from .Net 3.5 to .Net 4.0. After the upgrade I started getting following error when using KerberosOverTransport:</p>
  
  <p>An existing connection was forcibly closed by the remote host
     at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags)
     at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)</p>
  
  <p>Here's my client side Binding</p>
  
  <pre><code>  &lt;binding name="StreamingBinding_Kerberos"&gt;
        &lt;gzipMessageEncoding innerMessageEncoding="textMessageEncoding"
                             maxArrayLength="2147483647" /&gt;
        &lt;security authenticationMode="KerberosOverTransport"/&gt;
        &lt;httpsTransport transferMode="StreamedResponse"
                        maxReceivedMessageSize="536870912"
                        authenticationScheme="Anonymous" /&gt;
      &lt;/binding&gt;
  </code></pre>
  
  <p>Here's the endpoint I am using:
      
          
            
          
        
  I am returning a Stream from TestService method. All this was working fine with .Net 3.5 but as soon as we upgraded to .Net 4.0 all this stopped working.
  We have another binding using UsernameOverTransport which works without any issues even after.Net 4.0 upgrade.</p>
  
  <pre><code>  &lt;binding name="StreamingBinding_Username"&gt;
        &lt;gzipMessageEncoding innerMessageEncoding="textMessageEncoding"
                             maxArrayLength="2147483647" /&gt;
        &lt;security authenticationMode="UserNameOverTransport"/&gt;
        &lt;httpsTransport transferMode="StreamedResponse"
                        maxReceivedMessageSize="536870912"
                        authenticationScheme="Anonymous" /&gt;
      &lt;/binding&gt;
  </code></pre>
  
  <p>Please help!</p>