Sitecore WebAPI – Setting up IOC

I’ve had the opportunity to tinker in the depths of the WebAPI in Sitecore 7.5 and 8 recently. I’ll put up a post about setting up controllers easily shortly but until then I thought I’d share how to setup IOC.

In a normal WebAPI environment, we can create our resolver and attach it to the GlobalConfiguration. However, we must remember that Sitecore uses its own pipelines for MVC and WebAPI and so setting this up in the Global ASAX won’t work.

The way I’ve done it is to change the registered WebAPI initialiser class in the Sitecore.Services.Config file found in App_Config/Include. This lets me hook directly into the entry point for Sitecore related WebAPI and adjust the configuration accordingly.

Continue reading

Advertisements

Sitecore 8 upgrade – check your .NET version

One of my current clients is making the transition to Sitecore 8. This went reasonably well as we decided to do a fresh installation rather than follow the upgrade path and then copy any content in manually.

What we weren’t prepared for was a number of errors using Sql Server and IIS. Specifically we were getting heap exceptions with system.data.dll and ntdll.dll. However, what was funny was that these errors weren’t occuring on everyones systems. In fact the only repeatable thing was sporadic database issues with connectivity.

After some investigation we found that we were on .NET 4.5.1 and this has some known issues. So if you’re getting issues with IIS, the worker process or with the system.data dlls then this is one thing to look into.

Needless to say we did a test installation on a working system (well one with the least amount of issues) and this ran ok. Then we rolled it out to the other systems and this fixed our system. You can find out more about the list of known issues on the Microsoft support site.

The .Net 4.5.2 update is a web installer so you’ll need Internet access for any machine you’re updating.

Simon.