What I thought was a simple search on the web turned out to be more than that.
The closets to a solution I found was from the person who first made it possible to use Attributes for routing in ASP.NET MVC 4: AttributeRouting not working with HttpConfiguration object for writing Integration tests
But what about ASP.NET Web Api 2?
So … what is the problem.
It turns of that I was missing a simple little line, just after the “config.MapHttpAttributes();”
So finally I got this working.
But why on earth does the HttpServer class or something else not ensure that the config have been initialized.
So I was searching for a reason why this was needed and why this should actually be called.
If you decompile: System.Web.Http.GlobalConfiguration.Configure(Action<HttpConfiguration> configurationCallback)
You will get something like this:
Why on earth is it done like that … for me this has absolutely nothing to do with “Ensure” … THIS needs to be called after all configuration is done.
Is can be called multiple times with no side effects.
Why ohhh why do you sometime hate us so much Microsoft. :-)