tags:

views:

160

answers:

1

I am moving and old asmx webservice to a new server with IIS7.
This webservice basically sends a big dataset (10mb+) to a winform application.
The old solution was implemented using a custom soap extension which compressed the content before sending the stream to the client.
The client, of course, implemented the same custom soap extension, to decompressed the stream in a dataset. Everything has worked pretty well for years.
My customer doesn't want to change the code upgrading to WCF. They just want to put the old App on the new server and use the new dynamic content compression features.
We're testing things on a test server (win serv 2008) and it seems that it's working pretty well, even if it seems slow: we can't see any difference in performance (speed) between the uncompressed and compressed stream.
Here's the question. Where should I put the settings? Most people say I can't put it in my web.config; others say it can be put there. I am a bit confused.
Are there any tricks or things I should know? What about mimeTypes? Should I set some parameters, somewhere? ... considering my stream is XML (dataset) ??

Thanks to everyone who would like to help

Alberto

+1  A: 

Assuming you can easily disable your compression code, then using the IIS7 compression features is pretty simple.

You can enable and disable compression on a folder-folder level with web.config in IIS7.

However, the configuration that controls which mimetypes are compressed and which are not are stored at the webserver level.

To enable the dynamic compression on a given site/vdir/folder, assuming that the server has the Dynamic compression feature installed, just open up your site/folder in IIS manager, and then hit the 'Compression' icon. Here you can enable both static and dynamic compression.

At this point, check to see if it has worked (i.e. that the traffic does get compressed). If so, then the default dynamic compression config is working and you can go and grab and early lunch :)

If not, then you need to:

  • Click on the server node (at the root) in IIS manager. Then open the 'Configuration Editor' (on the bottom row, usually on the left).
  • In the dropdown on the form that appears, expand the system.webserver node, and then click on the 'httpCompression' leaf node.
  • Now you'll see all the server-wide configuration options for compression - you'll want to open up the 'dynamicTypes' setting.
  • In there you can add extra rules for the mimetypes you need to be compressing.

One thing that's a little bit annoying with this is that the mimetypes are matched exactly, and sometimes the default rules won't match everything you want.

I, for example, have added 4 extra rules to our servers:

  • application/json
  • application/xml

And then:

  • application/json; charset=utf8
  • application/xml; charset=utf8

Because, for some reason, I've found that the mimetype of my json/xml responses from .Net have had this extra 'charset=' bit at the end. If it does, and it's not in the rules list, then IIS7 compression will not kick in. Took me ages (and a lot of use of Fiddler!) to figure this bit out!

Andras Zoltan
Thanks for your reply Andras.When you're talking about "configuration Editor" you mean that one you have when you install the AdministrationPack, right?So, basically, for what you say there no way to work on settings at site level. I can't use my web.config if I want to have different behaviors for different sites/virtual sites; is that correct?thanks
vandalo
@vandalo - sorry for the delay. I'm not sure if you need the Admin pack... all I know is that after I installed IIS (making sure I enabled both static and dynamic compression options in the features) the options were available in IIS Manager. As for the different site/virtual site level - you can switch compression on and off on individual folders (and therefore sites and virtual folders) simply through a web.config; but the content types for dynamic compression can only be configured at the server level.
Andras Zoltan