Hi all,

We are using .net remoting for client-server communication. Application is distributed winforms app.

target framework is .net 3.5 sp1. remoting server is hosted in IIS 7.

Below is the client configuration for remoting:

<system.runtime.remoting>

<application>

<client>

<wellknown type="xyz" url="http://abc.com/pqr.soap" />

</client>

<channels>

<channel ref="http">

<clientProviders>

<formatter ref = "binary"/>

<provider type="CompressUtil.CompressionClientChannelSinkProvider, CompressUtil" compressionThreshold="1000" />

</clientProviders>

</channel>

</channels>

</application>

</system.runtime.remoting>

Server configuration:

<system.runtime.remoting>

<application>

<service>

<wellknown mode="SingleCall" type="xyz" objectUri="abc.soap" />

</service>

<channels>

<channel ref="http">

<serverProviders>

<provider type="CompressUtil.CompressionServerChannelSinkProvider, CompressUtil" compressionThreshold="1000" />

<formatter ref="binary" />

</serverProviders>

</channel>

</channels>

</application>

</system.runtime.remoting>

One colored line in both of above to configurations is compressoin layer we introduced to increase the bandwidth performance. It is responsible for compressing and decompressing the request/response on client/server. This layer uses standard dotnet framework compression classes for the purpose.

Client needs to send one request with fixed frequency say 5-min. that frequency changes to 10 secs if on particular requests client dont get desired data. when client gets desired data that frequency is reset to 5-min/(5-min minus time needed to get desired data).

Now sometimes this request fails with following exception:



System.Net.WebException: The underlying connection was closed: An unexpected error occurred on a receive. ---> System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. ---> System.Net.Sockets.SocketException: 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)

--- End of inner exception stack trace ---

at System.Net.Sockets.NetworkStream.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 ---



Server stack trace:

at System.Runtime.Remoting.Channels.Http.HttpClientTransportSink.ProcessResponseException(Web Exception webException, HttpWebResponse& response)

at System.Runtime.Remoting.Channels.Http.HttpClientTransportSink.ProcessMessage(IMessage msg, ITransportHeaders requestHeaders, Stream requestStream, ITransportHeaders& responseHeaders, Stream& responseStream)

at CompressUtil.CompressionClientChannelSink.ProcessMessage(IMessage msg, ITransportHeaders requestHeaders, Stream requestStream, ITransportHeaders& responseHeaders, Stream& responseStream)

at System.Runtime.Remoting.Channels.BinaryClientFormatterSink.SyncProcessMessage(IMessage msg)



Exception rethrown at [0]:

at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)

at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)

at getData()



Any idea why this is happening?

How to solve this issue?