WCF Security In Intranet Scenario : Thoughts On Cons and Pros

I am researching on best practices with WCF security in terms of "YOU SHOUD" vs "YOU CAN". While it is great to have "How to" stuff I am also interested in "Why" angle. I have common simple scenario of WinForms client consuming WCF service inside corp walls with Active Directory deployed. Here is what I came up with while looking at Hosting Services and Common Security Scenarios.

I have built simple Hello World WCF service that accepts Person object/message and echoes back "Hello, " + Person.FirstName. I was using DataContract serialization. I think it really does not matter what it does in terms of biz logic. What really matters for me is how to host it, what binding to apply, and what security settings to configure.

For my intranet scenario "Message Security with a Windows Client without Credential Negotiation" would fit most I think. It utilizes Active Directory for authentication and message protection in transit as well saving me from messing with certs, transport level protection SSL, IPSEC style and plain vanilla UserName and Passwords. I think it is great and apparently it is a pro part from security stand.

Since it uses wsHttpBinding binding I thought it would be natural choice to host it in IIS rather self hosted as it shows up in the example. Here I earn what IIS has to offer vs what I can write in C#...

I also implemented scenario where I used basicHttpBinding with security set to None...

I fired up Fiddler2 to see what runs on the wire in both cases. The difference was pretty notable in terms of response time and payload size. Of course all these goodies that come from using Kerberos from my Active Directory friend - authentication and message protection - have their cost in terms of performance. I guess it is cons part from performance stand. I presume the time is spent for negotiation with Domain Controller and for cryptographic operations - encryption and signing - for message protection. The other cons part would be message size that naturally inflates when encrypted.

 All my experiments are done with my demo lab domain that is totally based on VPC 2007 so the numbers should be taken with caution but I presume that it can give some food for thoughts. Consider simple message as follows:

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">


      <SayHello xmlns="http://tempuri.org/">

         <person xmlns:a="......." xmlns:i=".....">







Here is what I captured using Fiddler:




Message Encryption



Message Signing



Bites sent



Bites received



Time to last byte

20 ms

231 ms


When designing my next WCF solution for intranet scenario I will sure try to utilize current IT investment like AD and IIS to provide first class security and hosting services while saving on maintenance costs. On other hand I must take into account performance part, this consideration should reflect on message size - for example, think twice when tempted to use DataSet as DTO. It should also reflect on hosting options - using IIS 6.0 allows me to utilize Http traffic only.

Here is my take on intranet scenario where Windows 2003 Active Directory and IIS 6.0 deployed:

  • Utilize AD for message security and authentication.
  • Host WCF in IIS 6.0. If I had Windows Server 2008 with IIS7 I'd go for WAS hosting for sure since it allows binding other than Http and I presume this should improve performance.
  • Do not use DataSets for DTO rather carefully design custom most lightweight DTO (yes, invest as much time as needed for that one).
  • Use DataContract serialization with opt-in approach (allows fine tune what gets to the wires and what is not).

You have better suggestion for me around intranet scenario? If so, do not hesitate and drop me a line.

Here is even more food for thoughts A Performance Comparison of Windows Communication Foundation (WCF) with Existing Distributed Communication Technologies

Bon appetite.

Comments (3)
  1. alik levin's says:

    Service Trace Viewer Tool (SvcTraceViewer.exe) tool comes with Microsoft® Windows® Software Development

  2. alik levin's says:

    How to consume WCF services directly from Html client? How to add AJAX-like functionally to application

  3. alik levin's says:

    This is a digest of WCF Security resources I was collecting for some time. Drop me a comment in case

Comments are closed.

Skip to main content