title: The message received was unexpected or badly formatted
body: <p>I am trying to connect to a SSL Secured Webservice with my ASP.NET (C#) application. On my local machine everything works well, but on my server the folling error appears.</p>
  
  <hr>
  
  <p>**System.Net.WebException: The underlying connection was closed: An unexpected error occurred on a receive. ---> </p>
  
  <h2>System.IO.IOException: The decryption operation failed, see inner exception. ---> System.ComponentModel.Win32Exception: The message received was unexpected or badly formatted**</h2>
  
  <p>--- End of inner exception stack trace ---
     at System.Net.Security._SslStream.ProcessReadErrorCode(SecurityStatus errorCode, Byte[] buffer, Int32 offset, Int32 count, AsyncProtocolRequest asyncRequest, Byte[] extraBuffer)
     at System.Net.Security._SslStream.ProcessFrameBody(Int32 readBytes, Byte[] buffer, Int32 offset, Int32 count, AsyncProtocolRequest asyncRequest)
     at System.Net.Security._SslStream.StartFrameBody(Int32 readBytes, Byte[] buffer, Int32 offset, Int32 count, AsyncProtocolRequest asyncRequest)
     at System.Net.Security._SslStream.StartFrameHeader(Byte[] buffer, Int32 offset, Int32 count, AsyncProtocolRequest asyncRequest)
     at System.Net.Security._SslStream.StartReading(Byte[] buffer, Int32 offset, Int32 count, AsyncProtocolRequest asyncRequest)
     at System.Net.Security._SslStream.ProcessRead(Byte[] buffer, Int32 offset, Int32 count, AsyncProtocolRequest asyncRequest)
     at System.Net.TlsStream.Read(Byte[] buffer, Int32 offset, Int32 size)
     at System.Net.PooledStream.Read(Byte[] buffer, Int32 offset, Int32 size)
     at System.Net.Connection.SyncRead(HttpWebRequest request, Boolean userRetrievedStream, Boolean probeRead)
     --- End of inner exception stack trace ---
     at System.Web.Services.Protocols.WebClientProtocol.GetWebResponse(WebRequest request)
     at System.Web.Services.Protocols.HttpWebClientProtocol.GetWebResponse(WebRequest request)
     at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
     at Skuldabrefaafleidur.Skyrsla(SkyrslaRequest SkyrslaRequest) in d:\builds\36\Securities\D_SIFeedDaemon_1.0\Sources\SIFeedDaemon\Models\Skuldabrefaafleidur.cs:line 44
     at SIFeedDaemon.Services.DaemonProgram.SendDataToWebService(SkyrslaType pSkyrslaType) in d:\builds\36\Securities\D_SIFeedDaemon_1.0\Sources\SIFeedDaemon\Services\DaemonProgram.cs:line 163] - [beee4c0b-3a49-40ff-ad86-d14ba37b2bf5]</p>
  
  <p>I already granted the access for ASP.NET(NETWORK_SERVICE on server) to certificates store on the local machine by using winhttpcertcfg.exe. I'm running windows 7 with .net 4 and server is windows server 2008 with .net 4 support.</p>
  
  <p>Thx in advanced</p>
  
  <p>agh</p>