I'm facing a classic issue MaxReceivedMessageSize in a WCF service but setting up this value according 99% of internet's suggestions is not an option for me. The project must be more secure as possible and changing this property we're vulnerable to a DoS attack.
Today the web method returns a large list of a specific object. So, we're thinking if the server could send several chunks of data. Is it possible? What could you recommend?
Thanks!
Yes. It is possible to send in chunks.
Refer - http://msdn.microsoft.com/en-us/library/ms733742(v=vs.110).aspx
Related
I am passing the data to front end via WCF and binding the data using jQuery binding. From WCF I need to pass large amount of data,so it takes so much time to load. By going through other posts I come to know that GZip could be used for this. But I am not aware of the process. Please do help me on this.
Thanks in advance
There are two common ways of compressing large output in WCF:
Configure IIS to use compression. First, the compression feature has to be included in your server's install (not the default). Second, you can use IIS manager, to find the "compression" feature and enable it, per app. MSDN has some good directions to describe each step. https://technet.microsoft.com/en-us/library/cc771003(v=ws.10).aspx
Configure WCF to use Mtom compression. This is set in your web.config, in the section <bindings><wsHttpBinding><binding messageEncoding="Mtom" .... This SO, article has some very good examples, with explanations, etc. Streaming with WCF and MTOM
Good day all.
I am completely new to WCF and Im learning as I am going.
I just would like to know, what are the best way of downloading or uploading files by getting it directly from disc and not via http.
Currently I am using WCF and http using the chunk way, but for a specific set of file I need to do it differently.Any tips, help or links will help me alot
When you transfer large files the best way to using “WCF service + HTTP”, we can use the following types of bindings:
wsHttpBinding
basicHttpBinding
Where do your clients reside? If the transfer is within the same network, you can take a look at this article. Otherwise, check this information on MSDN.
I need to receive XML data from HttpPost requests. Currently I use HttpWebRequest to send the request and I convert the request to xml with StreamReader and XDocument.Parse.
Are there any benefits to switching over to WCF? Thanks!
If you don't plan to dramatically extend your application and only want to switch to WCF so that you are using it, no. :-)
WCF will give you some more flexibility - you could for example consume data in other data formats or from other transport formats (Named Pipes, ...)
I hope i understood your question correctly !!!
The use of WCF lies where you know that both the sending as well as receiving end share the same data contract.
I think in your case, using WCF will benefit if both are MS application and the contract is not supposed to change very frequently.
Can we identify if WCF Request is coming from our Silverlight APP or some place else?
You could possibly declare a [MessageContract] and define a header in there, which your Silverlight app could set to a known, defined value.
Marc
The headers should already have requester info in them, and you should be bale to parse it out and tick up a counter or whatever on the server side. I would think marc_s's suggestion of MessageContract would be the simpler solution however.
I would like to set the MSMQ message label using the NetMsmqBinding. I understand it’s easy when using the MsmqIntegrationBinding, but I would like to continue to use the NetMsmqBinding (even call private methods, if possible)
I thought this was an interesting question. Unfortunately, from everything I've seen, it looks like you can't access the Label property on an outgoing MSMQ message using NetMsmqBinding.
Here are some of the links I came across:
http://social.msdn.microsoft.com/Forums/en-US/wcf/thread/3389679b-a130-4e83-bb4c-1b522c216227/
http://blogs.msdn.com/skaufman/archive/2007/12/17/msmq-label-property-and-wcf.aspx
I couldn't find anything that explained exactly why, but the reasoning makes sense - the NetMsmqBinding does not expose anything specific to System.Messaging, so that the binding itself can be easily swapped out for another binding without any code changes. Like you said, the MsmqIntegrationBinding is tightly coupled to System.Messaging concepts, so you get access to all the System.Messaging stuff at the expense of interchangability with other bindings. If setting the Label is important, the easiest route will probably be to just use msmqIntegrationBinding.
George: No answer, but I'm curious to know how you plan to use the MSMQ label together with NetMsmqBinding.
The reason I ask is that NetMsmqBinding was really created to support the scenario in which both the sending and receiving endpoints are both WCF applications, so at that point you might as well just stick any out-of-band data you need in the message headers...
Use OperationContext.Current.IncomingMessageProperties.Values