I\'m very new to using Unity, but my problem is that whenever I call my web service, I get an exception stating that
\"Make sure that the controller has a parameterl
I know this is an old post but since I just ran into the same problem, the solution was to simply pass the config object to the Unity registration function and use the DependencyResolver from that instance:
EDIT: Just noted that the accepted answer does exacly this... Sorry for the spam ;-)
public static class UnityConfig
{
public static void Register(HttpConfiguration config)
{
var container = new UnityContainer();
// register your services here...
// replace...
/* GlobalConfiguration.Configuration.DependencyResolver = new Unity.WebApi.UnityDependencyResolver(container); */
// with this:
config.DependencyResolver = new Unity.WebApi.UnityDependencyResolver(container);
}
}