I am trying to save a huge data to database through a WCF service call. I am not able to invoke the service. Its throwing a error.
codeProxy.SaveCodes(reques
Use Stream property in message contract of WCF operation to transfer large objects.
[MessageContract]
public class DocumentDescription
{
[MessageBodyMember(Namespace = "http://example.com/App")]
public Stream Stream { get; set; }
}
Configure your binding this way
<binding name="Binding_DocumentService" receiveTimeout="03:00:00"
sendTimeout="02:00:00" transferMode="Streamed" maxReceivedMessageSize="2000000">
<security mode="Transport" />
</binding>
To upload large data into SQL Server database use approach described in the following article Download and Upload images from SQL Server via ASP.Net MVC
If you encounter this issue on a .Net 2.0 service this hotfix may help
http://support.microsoft.com/kb/974065
Issue
When you are running a .NET Framework 2.0-based application, the application crashes. If you debug the application, you notice that a System.InsufficientMemoryException exception is thrown. Then, you receive an error message that resembles the following: Failed to allocate a managed memory buffer of bytes. The amount of available memory may be low.
CAUSE
Cause of Issue 1
This issue occurs intermittently when the application tries to allocate memory for a large object in a large object heap (LOH). The error message is triggered when the following conditions are true: The heap cannot provide sufficient memory to satisfy the LOH allocation request. A concurrent garbage collection is in progress at the same time. Cause of Issue 2
This issue occurs because garbage collector heap balancing for small object allocations is not performed diligently on computers that have more than 8 logical processors. Because of this, more garbage collections are triggered to maintain heap balancing when there is an unbalanced workload in different processors. Therefore, the application spends more time on garbage collection.