-
The underlying connection was closed: An unexpected error occurred on a receive.
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?
-
hi there,
you web.config is interesting.
you have a single call defined for a method, which is standard.
on the other hand, you have a cao (client actived object) call.
most people don't use a cao call, but there must be a specific reason why you are using it.
besides, iis remoting is very secure, and with .soap it is extra secure but very slow.
if your method calls use .rem instead of .soap, meaning binary call instead of soap call, it will be still very secure but faster.
what i mean is to do a test with:
<client>
<wellknown type="xyz" url="http://abc.com/pqr.rem" />
</client>
and
<service>
<wellknown mode="SingleCall" type="xyz" objectUri="abc.rem" />
</service>
indeed, i would change the client call (in web.config on your client side) to
<client>
<wellknown type="<appropiate type>" url="http://abc.com/pqr.rem" />
</client>
in this way, you will avoid a cao call.
can you supply the code of getData() method?
maybe with the line where the error occurs?
good luck and happy new year,
tonci korsano
Similar Threads
-
By beachbum714 in forum .NET
Replies: 5
Last Post: 02-06-2006, 11:58 AM
-
Replies: 2
Last Post: 12-05-2005, 11:42 AM
-
By Sok Y. Kim in forum VB Classic
Replies: 4
Last Post: 10-29-2000, 11:54 PM
-
By Darta in forum VB Classic
Replies: 1
Last Post: 10-24-2000, 04:48 PM
-
By Bob Tsai in forum VB Classic
Replies: 0
Last Post: 03-27-2000, 11:35 AM
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Development Centers
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center
|