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.
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
I'm developing an app using MonoTouch and have to get some data from a 3rd party web service. I have a WCF binding to do such.
The particular web service method I am calling could potentially return an XML string in the range of several hundred megabytes, which could take a while to download to a mobile device.
I'm looking for some way to capture how many bytes have been read from the network at the system level, with the end-game being to display a progress indicator to the user. Is there some way I can achieve this using Behaviors?
Note, I don't have any way to modify the web service code to return a Stream object, which is what most of the articles I have found require doing.
Any help or direction would be much appreciated. Thanks
As a last resort, I can always fall back on using an NSURLConnection to do this, instead of WCF, because I know there are NSURLConnectionDelegate methods to hook into that will provide this. I wanted to avoid NSURLConnection, so that I will be able to easily drop this code into an Android project in the future.
Is there a reason to use WCF instead of the plain HttpWebRequest?
WCF is not exactly efficient at parsing data, it will keep multiple copies in memory to deserialize the various chunks of information.
There is no system level API that can provide this information, the Stream that you get back from the HttpWebRequest is the best value that you will get.
I am attempting to implement a reverse proxy using the RequestInterceptor from WCF REST starter kit. I am able to set the basic header properties and configure the calls. I am getting stuck with the following aspects:
Returning an appropriate response - my webservice can return text+xml, image or json. I am not able to send the appropriate response type. The Message.CreateMessage overloads are all SOAP aligned i.e. they accept only Xml constructs, so I am not able to send either JSON or image streams. I need to convert them into XElements - I am definitely doing something wrong here.
I also want the reverse proxy to be functioning well in the presence of cookies, gzip/deflate and SSL.
Based on the above requirements, do you think it makes sense to do this using REST starter kit? The Requestinterceptor was fairly easy to plug into, however the rest of the code is driving me nuts.
There is a mapping between both JSON and arbitrary binary content to XML which is used in messages for WCF (see some examples at http://blogs.msdn.com/b/carlosfigueira/archive/2011/04/19/wcf-extensibility-message-inspectors.aspx), so you can use Message.CreateMessage to create non-XML messages as well.
Having said that, it's really not intuitive to do that in WCF as of now. The new libraries in the WCF Web API - http://wcf.codeplex.com - provide a very nice way of intercepting / redirecting / bypassing the WCF pipeline especifically for HTTP messages. Also, it support multiple formats in a native way (i.e., without need to do some mapping to XML).
I need to read from a XML file, get some data from the file and return the data.
Do I need to create a WCF service for that?
If so, do i need to host the service? Im not too sure how exactly WCF works, (though Ive been through quite a few tutorials) What exactly do I need to implement? I guess the IService interface, the actual Service implementation, what about the client, do I need to worry about the client?
Thanks
No, you need an XMLReader
OLD example of a XMLReader
About WCF Services - just FYI
WCF developed not for working with XML. You can use LinqToXml for work with XML documents. It can be simpler then using XMLReader but, you'll have problems if you want to work with really BIG XML documents.
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.