Attribute Routing now works out of the box in Sitecore 8.2

Search for a command to run...

No comments yet. Be the first to comment.
Polly is great library for easily configuring different kinds of policies around code execution, be it retry, circuit breaker, caching or lots of other things. It's probably most often used around HTTP requests. If you haven't heard about it you defi...

This is part 2 of my series on unit testing in .NET (C#) and will be about my conventions regarding naming unit tests, how to structure them and which parts to test. And lastly I will help you increase readability of assertions and potential error me...

I feel like unit testing is very important and very beneficial in a lot of ways. It helps with not breaking existing functionality and thereby also making you more confident in changing code without fear of breaking important stuff. Often it also mak...

I've been working with Swagger through NSwag a lot recently and also needed to get it to work when hidden behind a reverse proxy - i.e. another service forwarding a request to the service exposing the Swagger UI. Some of the issues I've had along the...

The other day I was writing a unit test to verify what was supposed to happen when a Task would throw an exception when awaited. It wasn't as straight forward as I first assumed, but I quickly found this Stack Overflow post that helped me: https://st...

With the recently released version 8.2 Sitecore has changed how the Sitecore.Services.Client is initialized and it no longer conflicts with Web API Attribute Routing. In fact it is actually already configured for you and you don’t have to do anything (or it will break).
NOTE: If you want to use Attribute Routing in Sitecore 7.5-8.1 then take a look here.
Normally you would setup Attribute Routing during startup like this:
config.MapHttpAttributeRoutes();
But you shouldn’t do that; you will get an error if you do, when you then try to access your API:
A route named 'MS_attributerouteWebApi' is already in the route collection
This error is probably pretty self explanatory, but it’s because Sitecore does the same thing in the initialize pipeline and it tries to create a route with the same name, which is not allowed.