Upgrading to Web API 2 breaks application-Collection of common programming errors

I have an Umbraco 7 application which uses V4.0 assemblies for things like System.Web.WebHost, System.Web.Http and related assemblies. I’m trying to get a Web API2 dll working with the Umbraco application, and am having a tough time.

If I use assembly redirection to default to V5.0 assemblies, the app breaks when Umbraco loads and attempts to use a controller. The problem here is that in V5.0 of System.Web.Http, ApiController now has a check when setting Request. This check always fails and throws InvalidOperationException:

set
{
    if (value == null)
    {
        throw Error.PropertyNull();
    }
    HttpRequestContext requestContext = value.GetRequestContext();
    HttpRequestContext httpRequestContext = this.RequestContext;
    if (requestContext != null && requestContext != httpRequestContext)
    {
        throw new InvalidOperationException(SRResources.RequestContextConflict);
    }
    this.ControllerContext.Request = value;
    value.SetRequestContext(httpRequestContext);
    RequestBackedHttpRequestContext requestBackedHttpRequestContext = httpRequestContext as RequestBackedHttpRequestContext;
    if (requestBackedHttpRequestContext != null)
    {
        requestBackedHttpRequestContext.Request = value;
    }
}

The other thing I’m trying is to have both DLLs loaded and used appropriately. In this case I’m running into an error, but don’t know if I’m doing it correctly. All I’ve done is added folders to keep separate versions of the same dlls, and wire them up in the web.config using something like this:


error: CS1705: Assembly ‘WebApi, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null’ uses ‘System.Web.Http, Version=5.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35’ which has a higher version than referenced assembly ‘System.Web.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35’

Is there hope?