Saturday, April 23, 2011

WCF WSOD

Twice recently I got the White Screen Of Death in WCF. It's basically a blank HTML page. Very hard to diagnose. Here were the reasons:
  • An [Authorize] attribute where it should not have been.
  • Missing the HTTP Redirector Service in IIS. Install it under "Programs and Features".
If I find others I will post them here.

Saturday, March 5, 2011

ASP.NET web farm losing session

You have your ASP.NET web farm set up with the same site on both. Session state is pointed at a common session server or SQL Server. But as soon as a user hops from one web server to another she loses her session.

If you've come here, you already have read the blogs and the Microsoft knowledgebase. You have checked the machine keys and they are identical. You may have looked through the metabase, but it is not obvious what to look for.

This will help your diagnosis:

<%= AppDomain.CurrentDomain.GetData(".appId") %>

Put it in a page on your site in each server. I like to make a hidden page whose URL has to be typed. This is the magic string that ASP.NET uses to identify what app it is writing session for. The session server will not allow sessions to be visible across apps, so these strings must be identical across the farm. Note they are case sensitive.

Sorry, you'll have to figure out for yourself how to change this string in IIS. It's different for each version and I'm not an admin. But this should give you a reasonable target to shoot for.