Dependency on System.Web.Http.WebHost, Version=4.0.0.0?

Imported from the CodePlex archive for reference purposes. Support for MvcCodeRouting has ended.

Commented on
Happy New Year Max!

I have just started switching my MVC.NET apps to use the 4.5.1 framework now pre-installed on all our Windows Server 2012 R2 servers.

When trying to run the app against the new framework, it compiles but I immediately get an error that looks like a MVCodeRouting dependency to a specific version of System.Web.Http.WebHost. The version installed under 4.5.1 framework is 5.1

Server exception excerpt from Stack Trace:



[FileLoadException: Could not load file or assembly 'System.Web.Http.WebHost, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)]
MvcCodeRouting.Web.Http.WebHost.PreApplicationStartCode.Start() in d:\foss\MvcCodeRouting\src\MvcCodeRouting.Web.Http.WebHost\PreApplicationStartCode.cs:40

How do I get around this?

Thanks,
Wade
Commented on link
Nevermind Max - think I found a solution. Added the following to web.config file and no more complaints from the MvcCodeRouting infrastructure.
<runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
        <dependentAssembly>
            <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" culture="neutral" />
            <bindingRedirect oldVersion="0.0.0.0-5.1.0.0" newVersion="5.1.0.0" />
        </dependentAssembly>
        <dependentAssembly>
            <assemblyIdentity name="System.Web.Http" publicKeyToken="31bf3856ad364e35" culture="neutral" />
            <bindingRedirect oldVersion="0.0.0.0-5.1.0.0" newVersion="5.1.0.0" />
        </dependentAssembly>
        <dependentAssembly>
            <assemblyIdentity name="System.Web.Http.WebHost" publicKeyToken="31bf3856ad364e35" culture="neutral" />
            <bindingRedirect oldVersion="0.0.0.0-5.1.0.0" newVersion="5.1.0.0" />
        </dependentAssembly>
    </assemblyBinding>
</runtime>
Commented on link
Yup, it's a version redirect issue. Happy New Year to you also :)