we hosted WCF services in IIS 5.1 wndows xp sp3 with httpBasicBinding. The data tranferered is huge in size and transfered every 1 minute. For this to less data transfer Is it possible to compress the response of WCF service by using default http compression ? Can I have some sample code / article for using http comression in WCF?
nRk
There's a project on Codeplex available, I've used it successfully in projects.
See here: http://social.msdn.microsoft.com/forums/en-US/wcf/thread/5c67b0da-9e50-4ee1-b7ac-a4733c580980/
Anyway, have you considered compressing the data before it is sent, and uncompressing it back upon reception?
Another option would be to explore the streaming capabilities of WCF: http://msdn.microsoft.com/en-us/library/ms731913.aspx
Related
I have a desktop app that uploads 10 jpegs of size 2000 bytes in 1 second via my web service which is hosted under IIS
The Operation Contract is 1 way (ie not duplex) and I use MTOM in the binding.
Will there be any performance gain if I self-hosted it instead under a Windows Service?
There is a question with a interesting analyse about using different bindings for streaming data:
Streaming with WCF and MTOM
You may get improved response times because the ServiceHost will already be loaded into memory and ready to receive calls. This is not true of IIS hosting which may unload the appdomain during times of low traffic. So when a call does come in IIS will need to fire up the ServiceHost before it can process your call.
However, IIS provides you with some useful features such as reliability - a windows service can just crash and remain down for as long as it takes someone to notice.
Can we use net.TCP binding to implement GZip in WCF or it can only be configured with Http and WsHttp bindings.
I don't believe WCF supports GZip encoding using a TCP socket binding, however there is nothing stopping you sending GZiped compressed data over the wire, and manually compressing it using the methods built into the .NET framework: http://msdn.microsoft.com/en-us/library/system.io.compression.gzipstream.aspx.
Before you go down this route however, I would strongly recommend assesing other performance enhancing measures on your TCP services as detailed here: Transmitting the least amount of data over the wire with WCF
Wcf 4.5 RC support message encoder out of box
http://msdn.microsoft.com/en-us/library/aa751889(v=vs.110).aspx
I have a wcf application to upload files from clients to my server. I am using NetTcpbinding and WSHttpBinding but I need to control the bandwidth, how can I accomplish this??
AFAIK, there is no built-in throughput throttling at the WCF level. You might be able to leverage the QoS features built into Windows for that, but honestly, I've never tried it. I guess you could always write your own transport channel that supports it, though.
There are a lot of posts about transferring files through WCF, and most of them recommend streaming. I'm designing a WCF service that will have several different clients, .Net and non .Net (Delphi 2010 clients), downloading those files. What is the best method to transfer files when there will be non .Net clients?
Edit
I will be transferring the files through the internet via basicHttpBinding
Tks
I would recommend to use the MTOM encoding for binary data. It is the preferred way of passing data between compatible clients.
http://msdn.microsoft.com/en-us/library/aa751889.aspx
In my application I need to push notifications of real time events from server to clients. The amount of data to pass is very small, mostly and Id. The number of clients listening simultaneously can be around 100 and I may have to publish one notification every 2 - 3 seconds. Both the server and client are built using .Net and WCF.
Given these requirements I have built a set of WCF services which will be run on a load balanced server cluster. The Instance context mode is Per Call and there is no need for sessions etc.
I am currently using BasicHttpBinding. Will TCP binding be better? Does it run on IIS 5 or 6? If not why?
What configuration for serialization can work best?
What are the things I need to do to make sure I get maximum performance?
Edit - Adding more information based on some of the responses -
I host a small WCF service in the client process using manual hosting. The server just calls this service on each client to push the data to all of them.
Firstly have you considered using messaging for what you are trying to achieve?
In answer to will TCP binding work better than BasicHttpBinding- almost certainly yes. If you want to use TCP, you can't use IIS- look into WAS with Windows Server 2008. If you're stuck with Windows Server 2003, then you'll have to host in a windows service instead.
You've made a good choice by choosing per call- this is the preferred instance management mode for creating scalable WCF services.
Edit:
Now you've update your question, I recommend you take a look at IDesign's Pub/Sub framework if you want to stick with WCF. I'd also look at Pub/Sub with MSMQ in WCF and also with "Vanilla" products such as Tibco RV.
If you need pushing data from service to clients you need sessions and you need duplex binding - NetTcpBinding or WSDualHttpBinding. It will not work with BasicHttpBinding because it allows only pulling data (client pools the service for changes). Push data means tha service sends data to clients when needed.
NetTcpBinding always crete session. It can't be hosted in IIS 6 or older. NetTcpBinding is allowed only in Windows Activation Service (WAS) which is extension of IIS 7.x. For older systems you need self hosting = windows service.
Edit:
Based on your description you need Publish-Subscribe message exchange pattern.