# Saturday, March 09, 2013

Thanks to everyone who attended my sessions at Devweek 2013 – I had a lot of fun delivering them. It was also great to catch up with old friends and make a few new ones.

As promised I have uploaded all of my slides and demos to the cloud and they can be downloaded here

WCF Preconference Workshop
Reactive Framework
Living with the GC
Workflow 4.5
WCF 4.5 (remember you’ll need to be running Windows 8 for the WebSockets demos)
What’s new in Unit Testing in VS 2012 (remember that Fakes is only in VS Ultimate SKU)

Saturday, March 09, 2013 9:12:53 AM (GMT Standard Time, UTC+00:00)  #    Disclaimer  |   | 
# Tuesday, March 05, 2013

Thanks to everyone who attended my Devweek 2013 pre-conference session on WCF.

You can get the slides and demos here

Tuesday, March 05, 2013 8:50:40 AM (GMT Standard Time, UTC+00:00)  #    Disclaimer  |   | 
# Saturday, October 06, 2012

“Who moved my Cheese” was how a number of people at Microsoft have characterized people’s reaction to Windows 8. In other words – “all the stuff you need is there, I know its uncomfortable that we changed things but its just cosmetic”.

To a degree this characterization is right that mostly existing functionality it there just you access it in different ways – and there is new functionality that we didn’t have before. However there is a bigger issue with Windows 8 – one of chocolate.

The Windows 8 desktop is cheese – that’s users’ familiar world prior to Windows 8. But in Windows 8 we have another way to access functionality – one that’s tablet friendly, iPad user friendly, touch friendly – that’s not cheese, that’s chocolate – people love chocolate! Finally Windows has a world that means they are not offering cheese to those chocophiles and that can only be a good thing from Microsoft’s perspective.

I’m a professional software developer basing most of my work in the Windows world. I’ve used Windows heavily since Windows 3.1 and I’ve (mostly) liked the evolution of the operating system. I currently run a big multicore machine with two high-resolution monitors for software development. The important thing for me is being able to have my development environment (Visual Studio 2012 now) as my focus but have my email, browser windows, Skype, a few Windows explorer windows, VSphere, Excel, Powerpoint and many other applications running concurrently and being able to have many of the visible at the same time correlating data between them - all of these are cheese applications.

I have been running Windows 8 for a while and really like the immersive nature of many of the “Modern Windows” (or Chocolate) applications – especially as I can run these on one monitor and have my Cheese applications running on the other monitor. And if I need to, both of my monitors can be cheese based if I have a bunch of cheese like things going on.

The problem is I just don’t like Windows 8.

It’s the damn Windows key.

If I’m in the mood for chocolate then I really like chocolate – and if you always offer me chocolate I’m very happy.

But actually I’m a savory guy – I spend most of my time wanting cheese. When I press the windows key you offer me chocolate and I select cheese – if I had to do that once I would be OK with that but every single time I want cheese you say “Aha! I think you want some chocolate” Dammit! I’ve chosen cheese every time for the last hour I obviously don’t want chocolate at the moment!

OK I’ve done that metaphor to death. The problem with windows 8 is you force me to context switch every time I want to run another desktop application. It is disruptive and painful as a user experience. If I’m in the desktop world then please, please let me start another desktop application without going via Metro.

Saturday, October 06, 2012 10:39:01 PM (GMT Daylight Time, UTC+01:00)  #    Disclaimer  |   | 
# Wednesday, July 25, 2012

Microsoft recently announced the beta of Service Bus 1.0 for Windows Server. This is the on-premise version of the Azure Service Bus that so many have been asking for. There is a good walkthrough of the new beta in the MSDN documentation here including how to install it.

So why this blog post? Well if you install the beta on a Windows Server 2008 R2 box and you actually develop on another machine then there’s a couple of things not mentioned in the documentation that you need to do (having previously spent long hour glaring at certificate errors allowed me to resolve things pretty quickly)

First a little background into why there is an issue. Certificate validation has a number of steps to it for a certificate to be considered valid:

  1. The issuer of the cert must be trusted. In fact the issuer of the issuer must also be trusted. In fact the issuer of the issuer of the issuer must be trusted. In fact … well you get the picture. In other words, when a certificate is validated all certificates in the chain of issuers must be trusted back to a trusted root CA (normally bodies like Verisign or your corporate certificate server). You will find these in your certificate store in the “Trusted Root Certificate Authorities” section. This mechanism is known as chain trust.
  2. The certificate must be in date (between the valid from and valid to dates)
  3. The usage of the certificate must be correct for the supported purposes of the cert (server authentication, client authentication, code signing, etc)
  4. For a server authentication cert (often known as an SSL cert) the subject of the cert must be the same as the server DNS name
  5. The certificate must not be revoked (if a cert is compromised the issuer can revoke the cert and publishes this in a revocation list) according to the issuers revocation list

For 1. there is an alternative called Peer Trust where the presented certificate must be in the clients Trusted People section of their certificate store

There may be other forms of validation but these are the ones that typically fail

So the issue is that the installer of Service Bus (SB), if you just run through the default install, generates a Certificate Authority cert and puts it into the target machine’s Trusted CA store – it obviously doesn’t put it in the client’s Trusted CA store because it knows nothing about that. It also generates a server authentication cert with the machine name you are installing on. This causes two issues: no cert issued by the CA will be trusted and so an SSL failure will happen the first time you try to talk to SB, the generated SSL cert will have problems generally validating due to, for example, no revocation list

The first of these issues can be fixed by exporting the generated CA cert and importing it into the Trusted CA Store ion the dev machine


The second can be fixed by exporting the SSL cert and importing it into the trusted people store on the dev machine


With these in place the Getting Started / Brokered Messaging / QueuesOnPrem sample should work fine

.NET | Azure | ServiceBus | WCF
Wednesday, July 25, 2012 5:04:54 PM (GMT Daylight Time, UTC+01:00)  #    Disclaimer  |   | 
# Monday, July 02, 2012

The demos from DEV 326 – my talk on WCF 4.5 at TechEd EMEA are available here. The session was also recorded and the video is now on Channel9 here

Monday, July 02, 2012 2:13:14 PM (GMT Daylight Time, UTC+01:00)  #    Disclaimer  |   | 
# Tuesday, January 17, 2012

To celebrate DevelopMentor’s move to offices at 120 Moorgate in London, myself and Andy Clymer are presenting an evening of C# 5 Async. The next version of the C# language has built-in support for async processing. We’ll show you how it improves over the previous models and how it works under the covers.

This event is on Monday the 6th February from 5-7 and is free to attend, just register with the DevelopMentor office on 01242 525 108 or email salesuk@develop.com

Tuesday, January 17, 2012 8:18:38 AM (GMT Standard Time, UTC+00:00)  #    Disclaimer  |   | 
# Wednesday, September 28, 2011

Thanks to everyone for attending my sessions on the Reactive Framework and Garbage Collection at Basta 2011, you can download the demos here:

Reactive Framework

Garbage Collection

Wednesday, September 28, 2011 11:46:31 PM (GMT Daylight Time, UTC+01:00)  #    Disclaimer  |   | 
# Wednesday, June 15, 2011

Just a heads up that when self hosting the new WCF Web API. By default if you try to add the Web API references via Nuget you will get a failure (E_FAIL returned from a COM component).

This is due to the likely project types (Console, Windows Service, WPF) defaulting to the client profile rather than the full framework. If you change the project to the full framework the Nuget packages install correctly

Yet again bitten by the Client Profile

Wednesday, June 15, 2011 10:21:33 AM (GMT Daylight Time, UTC+01:00)  #    Disclaimer  |   | 
# Friday, February 04, 2011

I have just found myself answering essentially the same question 4 times on the MSDN WCF Forum about how instances, threading and throttling interact in WCF. So to save myself some typing I will walk through the relationships here and then I can reference this post in questions.

WCF has 3 built in instancing models: PerCall, PerSession and Single. They are set on the InstanceContextMode on the ServiceBehavior attribute on the service implementation. They relate to how many instances of the service implementation class get used when requests come in, and work as follows:

  • Single – one instance of the implementation class is used for all requests
  • PerCall – every request gets its own instance of the implementation class
  • PerSession – this is the slightly odd one as it means every session gets its own instance. In practical terms it means that for Session supporting bindings: NetTcpBinding, WSHttpBinding, NetNamedPipeBinding, etc, every proxy gets an instance of the service. For bindings that do not support session: BasicHttpBinding, WebHttpBinding, we get the same effect as PerCall. To add to the confusion, this setting is the default

By default WCF assumes you do not understand multithreading. Therefore, it only allows one thread at a time into an instance of the service implementation class unless you tell it otherwise. You can control this behavior using the ConcurrencyMode on the ServiceBehavior; it has 3 values:

  • Single – this is the default and only one thread can get into an instance at a time
  • Multiple – any thread can enter an instance at any time
  • Reentrant – only makes a difference in duplex services but means that an inbound request can be received from the component you are currently making a request to (sounds a bit vague but in duplex the role of service and client are somewhat arbitrary)

Now these two concepts are different but have some level of interaction.

If you set InstanceContextMode to Single and ConcurrencyMode to Single then your service will process exactly one request at a time. If you set InstanceContextMode to Single and ConcurrencyMode to Multiple then your service processes many requests but you are responsible for ensuring your code is threadsafe.

If you set InstanceContextMode to PerCall then ConcurrencyMode Single and Multiple behave the same as each request gets its own instance

For PerSession ConcurrencyMode Multiple is only required if you want to support a client sending multiple requests through the same proxy from multiple threads concurrently

Unless you turn on ASP.NET Compatibility, WCF calls are processed on IO threads in the system threadpool. There is no thread affinity so any of these threads could process a request. The number of threads being used will grow until the throughput of the service matches the number of concurrent requests (assuming the server machine has the resources to match the number of concurrent requests). Although the number of IO threads is capped at 1000 by default, if you hit this many then unless you are running on some big iron hardware you probably have problems in your architecture.

Throttling is there to ensure your service is not swamped in terms of resources. There are three throttles in place:

  • MaxConcurrentCalls – the number of concurrent calls that can be made – under .NET 4 defaults to 16 x number of cores
  • MaxConcurrentSessions – the number of concurrent sessions that can be in in flight – under .NET 4 defaults to 100 x number of cores
  • MaxConcurrentObjects – the number of service implementation objects that are in use – defaults to the sum of MaxConcurrentCalls + MaxConcurrentSessions

In reality, depending on whether you are using sessions or not, the session or call throttle will affect your service the most. The object one will only affect your service if you set it lower than the others or you do something unsual and handle the mapping of requests to objects yourself using a custom IInstanceContextProvider

You can control the throttle values using the serviceThrottling service behavior which you set in the config file or in code

Friday, February 04, 2011 9:50:40 PM (GMT Standard Time, UTC+00:00)  #    Disclaimer  |   | 
# Tuesday, June 08, 2010


I’m speaking at Software Architect 2010 in October. I’m going to be delivering two sessions on Windows Workflow Foundation 4.0: the first explains the basic architecture and looks at using workflow as a Visual Scripting environment to empower business users. The second looks at building big systems with workflow concentrating on the WCF integration features.

In addition to that I’ll be delivering two all-day workshops with Andy Clymer: Building Applications the .NET 4.0 Way and Moving to the Parallel Mindset with .NET 4.0. The first of these will take a number of new features of .NET 4.0 and show how they can be combined to create compelling applications. The second will look at the Parallel Framework Extensions (PFx) introduced in .NET 4.0 examining both the rich functionality of the library, how it can be best leveraged avoiding common parallel pitfalls and finally looking at patterns that aid parallelisation of your code

.NET | PFx | RSK | WCF | WF | WF4
Tuesday, June 08, 2010 10:52:40 AM (GMT Daylight Time, UTC+01:00)  #    Disclaimer  |   |