Microsoft Knowledge Base Article
This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved.
Terms
of Use |
Trademarks
Article ID: 322975 - Last Review: December 3, 2007 - Revision: 4.4
BUG: Passing large quantities of data in .NET Remoting calls causes an unexpected exception to occur
This article was previously published under Q322975
You can use .NET Remoting to allow instances of any type
that can be serialized to be passed as method parameters between the client and
the server applications. However, if the type instance that is passed is very
large (tens of megabytes), the Remoting client consumes large amounts of
virtual memory and then generates unexpected exceptions. The exceptions can be
either OutOfMemoryException exception or SocketException exception. The commit
charge as seen in Task Manager is also very high.
This is because of a bug in the .NET Remoting system.
To work around this problem, pass smaller amounts of data
with each remoted call. You can also pass a
Stream object as a method parameter.
Stream objects inherit
MarshalByRefObject. You can use the
Stream object to retrieve data in smaller chunks.
Microsoft has confirmed that this is a bug in the Microsoft
products that are listed at the beginning of this article.
When the class below is hosted in a Remoting host, and the
method is called by a Remoting client, the problem occurs. The following code
fragment demonstrates the problem:
public class MBRClass : MarshalByRefObject
{
public byte[] GetBigByteArray ()
{
byte[] byteArray = new byte[60000000] ;
return byteArray ;
}
}
APPLIES TO
- Microsoft .NET Framework 1.0
- Microsoft .NET Framework 1.0 Service Pack 1
- Microsoft .NET Framework 1.0 Service Pack 2
- Microsoft .NET Framework 1.1
- Microsoft .NET Framework 1.1 Service Pack 1
| kbbug kbremoting KB322975 |
Community Feedback System
Very often, it takes hours to solve a problem. Very often, you've looked high
and low, and have tried a lot of solutions. When you finally found it, chances
are, it was because someone else helped you. Here's your chance to give back.
Use our community feedback tool to let others know what worked for you and what
didn't.
Please also understand that the community feedback system is not warranted to be
correct, it's simply a system that we've built to let people try and help each
other. If something in a feedback response doesn't make sense to you, or you're
not comfortable making changes that the feedback talks about (like registry
edits), please consult a professional.
Thank you for using kbAlertz.com Feedback System.
-- Scott Cate