Max parameter size for WCF service
Have a WCF service (hosted in IIS 6.0) that takes an XML feed from SAP with potentially tens of thousands (or more) of records to process.
[OperationContract]
[FaultContractAttribute(typeof (ArgumentException))]
void ProcessSapRoles(XElement SapData);
I'm concerned about limitations on parameter sizes. From other SO articles, I'm reading that upping the maxRequestLength
on the httpRuntime
setting in the web.config will help this (I'm sure I'll have to increase the send timeout, as well). I've also read that using a NetTcpBinding will help, though I wouldn't know limitations for using this or how to configure it.
I suppose I could have the caller make 100,000 calls, one per record, but I'd think the performance impact would be significant. Also, on the other side, I have to query existing records to see if I'm updating or adding records, and then send the updates back to the database. Creating 100,000 datasets for 100,000 separate queries of one record each seems crippling, as well.
Pre-WCF, we used compression sinks on a remoting chain, which significantly increased performance (sending our largest datasets were timing out the web page after 20 minutes; after adding the compression sink, the datasets were crossing the wire in about 20 seconds) (and the customer was responsible for making datasets that la开发者_如何学编程rge, we had no control over them : P ).
How best to handle passing potentially 100,000 records, and is there any equivalent concept of a compression sink for WCF?
TIA!
JamesWCF services are limited to 64KB in parameter size - by default. This is for a good reason - the service will have to have a buffer (or potentially several buffers, for simultaneous callers) of that size, and if that size would be too big, one could pretty easily flood a server with bogus huge requests and bring it to its knees. No matter how much RAM you have - at some point, it'll run out.
BUT: the good thing is: as pretty much everything, you can configure this pretty easily. If you combine a large message size with the highly optimized NetTcpBinding
in a corporate LAN environment (behind firewalls), you should be both safe, and you should be able to transmit just about any size document between your client and a service.
Have you considered using Streaming in WCF
to transfer large data?
On a side note, NetTcp
will absolutely help. The reason is it uses Binary encoding
by default. On the other hand, Http
uses Text encoding
by default which needs extra space.
精彩评论