27 Jan 2012

Windows Server 2008 - MVC 3 - getting 404 errors from IIS 7

Well this one got us stumped for a long time this afternoon, and not even the mighty StackOverflow could help us!

We have an MVC 3 site that was running happily in dev, but when the client asked us to install it on their server (Windows 2008 SP2 (NOT R2), IIS 7.0), it wouldn't work; every View returned a 404.

We had just installed MVC 3 and ASP.NET 4, so we went though all the usual suspects:
  • Integrated pipeline
  • Permissions
  • runAllManagedModulesForAllRequests in system.webserver
No dice.

Eventually a random comment on some forum led us to the KB980368 Hotfix. That solved the problem!

VAG-COM / VCDS in Yorkshire for Audi A4 B7 Cabriolet

I wanted to change some settings on my A4 Cabriolet. The settings were:
  • Turn off selective locking (fob click only opens driver's door)
  • Turn off speed locking  (auto locking after 10mph)
  • Turn off seatbelt warning (module 17 penultimate code flip digit to 0) 
  • Enable telephone voice control (Electronics 2 - module 77 penultimate code flip digit from 0->2)  
To do this you need special software and a cable to the diagnostic port. The official VAS kit is crazy expensive, but the Ross-Tech VAG-COM/VCDS kit is £250. Still too much for me. I knew *what* to do from my research on the Audi forums, but I didn't have the kit.

So after an hour of waiting at Harrogate Audi in their swanky coffee area, they finally told me they had been unable to make the changes, and couldn't spare any more time looking at it. They also said not to believe everything you read on the Internet.

BAD HARROGATE AUDI, NO BISCUIT.

Well, just wanted to say that a good chap called Chris Dodgson from Auto Diagnostic Services drove his van round to my office today, plugged in his VCDS laptop and sorted all the changes in about 10 minutes.

It goes to show that Harrogate Audi is just a showroom, and their service department doesn't know how to do simple electronic changes on Audis. What a ridiculous situation.


18 Jan 2012

ValueInjecter - matching nullable to non-nullable values

Here's a little ValueInjecter plugin I wrote to handle ValueInjecter matching for properties where the name matches but one is nullable and the other is not.
        
public class NullableInjection : ConventionInjection
{
 protected override bool Match(ConventionInfo c)
 {
  return c.SourceProp.Name == c.TargetProp.Name &&
      (c.SourceProp.Type == c.TargetProp.Type 
    || c.SourceProp.Type == Nullable.GetUnderlyingType(c.TargetProp.Type)
    || (Nullable.GetUnderlyingType(c.SourceProp.Type) == c.TargetProp.Type 
      && c.SourceProp.Value != null )
    );
 }

 protected override object SetValue(ConventionInfo c)
 {
  return c.SourceProp.Value;
 }
}

So I just use it like so:
targetModel.InjectFrom<NullableInjection>(sourceModel);
If I helped you out today, you can buy me a beer below. Cheers!