Saturday, 18 August 2012

SECURITY_DENIED_BY_MIMEMAP Hosting WCF Services in IIS 7 Classic Mode

Another one of those gotchas where the error message doesn't actually have anything to do with the problem...

One of our apps includes a WCF service endpoint that's called by some of our other systems. This works perfectly in production, but when I fired it up locally this morning to fix a bug, I just couldn't get the thing to run properly - the right handlers were mapped, the file permissions were OK, but every time I pointed a browser at http://www.mysite.com.local/some_app/endpoint.svc , I got an HTTP 403 Forbidden.

Turning on IIS failed request tracing gave me one of those incredibly detailed XML dump files:

imageSo... SECURITY_DENIED_BY_MIMEMAP. Which is a little odd, because I was pretty sure MIME mapping only applied to static content - but sure enough, I tried setting up a MIME mapping for .svc files - mapped to application/xml. This didn't work - IIS just sent me the .svc definition file instead of actually executing it...

Turns out that the problem is our production servers are 32-bit and our development boxes are x64 - and I hadn't gone into the IIS Application Pool for this app and enabled 32-bit applications.

image

Quite why this results in the misleading MIME type error is one of those little mysteries that makes IIS such fun to work with, but that solved it for me.

Friday, 3 August 2012

Planning Poker… with LOLCATS

So… there’s this thing called planning poker, which although it looks a little odd at first, is actually a really effective way to flush out uncertainty during software planning meetings. It’s played with a special deck of cards, and for the last year or two we’ve been using a couple of decks that I got at a SkillsMatter event.

Now, in normal poker, all the cards need to be from the same deck – otherwise you could read the card backs. Obvious. But with planning poker, only the cards in your own hand need to be the same – there’s no reason why your deck needs to be the same as the other people in the planning session – so there’s nothing stopping you making your own planning poker cards. So, thanks to a bit of interwebbing, a little bit of magick and those wonderful people at MOO.com, I give you my one-of-a-kind LOLcat planning poker deck.

image

Whilst I’m here, I want to say a public thanks to MOO for their outstanding customer service… I got this e-mail from them on Tuesday:

Dear Dylan,

I'm afraid we have been experiencing some problems rendering your order. I think I have managed to fix it now, but we had to enlist the help of our developers to ascertain the cause of the problems. As I can see these are Agile estimation cards, I thought I'd share the more complex development solution to the problem :-)

Basically, the PNGs are a bit odd: all but the first two have offsets that position our canvas outside of the actual image. Our cropping implementation obeys the offsets, and finds that cropping produces a 0 width image. This is bad. You'll find that if you open the images with GIMP or, probably, Photoshop it'll report that something a bit odd is going on. Unfortunately some software (browsers, the flash) either helpfully ignore the duff offsets, or just don't support offsets at all (so mask the problem.)

Now for some guess work, the offsets in the PNGs suggest that they were originally all part of one large (2080x2340) image. Did you perhaps use an automated process to extract the images, to make them suitable for uploading to Moo? The obvious way to achieve this using ImageMagick is to use the -extract command, but with pngs this has an odd side effect: it gives you an output image of the size you asked for, but sets the canvas to the width and height of the original image, with the offset as specified in the extract command. This is not very helpful.

I hope that this all makes sense and helps to avoid this problem in the future. I have also upgraded your order to rush printing, and they will be shipped tomorrow.

If you have any questions, please do not hesitate to get in touch by replying to this email.

They are absolutely spot-on – the way I made the cards was to start off with a 2080x2340 PNG file, use ImageMagick to crop it into 4x3 cards, and then upload the cropped tiles to MOO for printing. So, if you fancy getting your own deck printed, here’s what you’ll need to do:

  1. Download this template.png – it’s a huge PNG with transparent windows for you to arrange your images of choice behind the frame on each card. (No, you can’t have my LOLCAT pictures. Mainly because I don’t own the copyright, but also ‘cos choosing your own pictures is half the fun)
  2. Put photographs in it, tweak it to suit, flatten it, and save it as agile_cards.png – this should be a single 2080x2340 PNG file
  3. Download ImageMagick if you don’t have it already.
  4. Use ImageMagick’s convert.exe to slice your file into cards:

    D:\lolcards>C:\Program Files\ImageMagick\convert.exe –crop 520x780 agile_cards.png card%02d.png
  5. Use ImageMagick to strip the offset from the individual card files – this is the bit that’ll stop you having the same problem I had above:

    D:\lolcards>C:\Program Files\ImageMagick\mogrify.exe +repage card*.png
  6. Design an image for your card back
  7. Head over to MOO.com, and use your agile card pictures to order a pack of rounded-corner business cards. I only used ten of the card images, so a pack of 50 cards includes five full sets of cards – with their classic paper and rounded corners, my deck was £13.49 + postage and VAT.
  8. Wait for the postman

Who knows… maybe personalized planning decks will become the software developer equivalent of personalised guitar picks or golf balls… ? Or maybe they’re just fun. Mine certainly brought a few smiles to people’s faces this morning.