Tag Archives: silverlight

WCF RIA gzip compression of response

I was trying to enable gzip compression of my WCF RIA traffic to decrease the amount of data that is send between the client and server and improve performance.

Note: I used Fiddler2 to determine if the responses were actually compressed or not.

There is a lot of Q&A about this topic on the web, but nobody had a straight solution for me. Some posts refered to old versions of IIS or used 3rd party modules.

I was looking for a solution that will work from with IIS7.5 without installing any 3rd party modules.

Here is how I made it work.

Lets first install the necessary modules: the Dynamic and Static Content Compression modules:

How-to enable GZIP compression for normal traffic:
On Windows 7:
“Start->Control Panel->Programs and features” and click on “Turn Windows features on or off”.
Then enable:
“Dynamic Content Compression” and “Static Content Compression” in “Internet Information Services->World Wide Webservices->Performance Features” and press “Ok”.

Now your ‘normal’ HTTP responses are automatically compressed, but your WCF RIA traffic is not.

To enable this we will need to add the mime-type of our WCF RIA traffic to the list of mime-types that need to be compressed. On my system the mime-type for my WCF RIA traffic is application/msbin1. I assume this is the same for everybody.

How-to enable GZIP compression for WCF RIA Services traffic:
Open a command box (cmd.exe)
Navigate to C:\Windows\system32\Inetsrv\ and execute the following command to add the application/msbin1 mime-type to the list of types that needs to be compressed:

appcmd.exe set config -section:system.webServer/httpCompression /+”dynamicTypes.[mimeType=’application/msbin1′,enabled=’True’]” /commit:apphost

This will add an entry into the Windows\System32\Inetsrv\Config\applicationHost.config file.

Now restart your IIS server and compression is enabled for the WCF RIA Services.


HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-Length: 583
Content-Type: application/msbin1
Expires: -1
Server: Microsoft-IIS/7.5
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
Date: Thu, 11 Aug 2011 17:47:10 GMT


HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-Type: application/msbin1
Content-Encoding: gzip
Expires: -1
Vary: Accept-Encoding
Server: Microsoft-IIS/7.5
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
Date: Thu, 11 Aug 2011 17:48:01 GMT
Content-Length: 336

I hope this post was helpful!

Useful link: http://www.iis.net/ConfigReference/system.webServer/httpCompression

Tips & Tricks: Listening to Dependency Property change notifications of a given Element


I want to share this great post from Anoop that shows a easy way to add a notification system to dependency properties of a given element. It creates and attaches a new property to the existing property and let’s you specify the PropertyChangedCallback eventhandler.

There are different examples on the internet, but i like how Anoop created a generic method with access to the callback event handler.

Here is the main part of the code:

        /// Listen for change of the dependency property
        public void RegisterForNotification(string propertyName, FrameworkElement element, PropertyChangedCallback callback)
            //Bind to a depedency property
            Binding b = new Binding(propertyName) { Source = element };
            var prop = System.Windows.DependencyProperty.RegisterAttached(
                new System.Windows.PropertyMetadata(callback));

            element.SetBinding(prop, b);

And here is an example on how to use it:

//Shows a message box when the text of the Textbox changes.
	("Text", this.txtMain,(d,e)=>MessageBox.Show("Text changed"));

Read Anoop’s complete article for more information!

update (07/28/2011):
here is small update of the code so it also works with other objects instead of just FrameworkElements

        private void RegisterForNotification(string propertyName, object source, PropertyChangedCallback callback)
            Binding b = new Binding(propertyName);
            b.Source = source;

            DependencyProperty prop = System.Windows.DependencyProperty.RegisterAttached(
                "ListenAttached" + propertyName,
                new System.Windows.PropertyMetadata(callback));

            BindingOperations.SetBinding(this, prop, b);

Tips & Tricks: Accessing MembershipProvider from Silverlight

As you might noticed in the previous post, i’m working on a implementation of a custom MembershipProvider.

Well here is another useful link that shows how you can easily expose the AuthenticationService for your Silverlight application as a WCF Service:

Accessing the ASP.NET Authentication, Profile and Role Service in Silverlight

I will probably have some other posts coming up about using the MembershipProvider in Silverlight and ASP.Net, so keep an eye out.

Esri DevSummit presentation


Silverlight: How to Display Dynamically Created Layers in Your RIA Application


The best way to access map layers in a Silverlight application is by consuming lightweight services such as the REST endpoints. In many cases, the map data is collected, created, or combined dynamically rather than published statically.

We will demonstrate how to use the Esri Silverlight Software Developer Kit (SDK) to execute a geoprocessor task on the REST endpoint and display the results to the user using two different techniques: a result map service and a dynamically created MapServer service.

The geoprocessor tasks consist of Python scripts based on the ArcGIS API for Python (ArcPy).

We will also discuss some issues we encountered and best practices and show techniques for debugging your Silverlight application when communicating with the different ArcGIS services.

This demonstration is based on a noise modeling application that Foliage developed for one of its customers.


The presentation with full source-code can be downloaded HERE.

It tries to explain two concepts:

1) How to dynamically create a MapServer service (during runtime)

2) How to use the Result Map Service.

And discusses reasons why you want to use this and how you can debug it.

Go to the Esri website for all the additional information (when, where, etc). Esri will also record the presentation and make it available as a video.

I hope you like it! Leave a comment or contact me if you have any comments or questions!

UPDATE 3/9/2011: Make sure you set up a host alias for esridevsummit to point to your localhost, you can do this in c:\windows\system32\drivers\etc\hosts; add the following: esridevsummit

this will also help you to debug your communication using Fiddler.

UPDATE 3/24/2011: You can download the presentation HERE or watch it online at the Esri website

UPDATE 4/04/2011: Embedded the video, removed the download.

ESRI DevSummit presentation from Bjorn Kuiper on Vimeo.