I have been trying to get WebApi
working with Sitecore 7.5 (I was able to get the same code working with 7.2)
I have left in the config the reference to MVC 5.1
and
I am getting the following exception when I try to access a route mapped with an attribute:
[RoutePrefix("test/api/Other")]
[Route("{action=Get}")]
public class OtherController : ApiController
{
[HttpGet]
public string GetId()
{
return "test";
}
}
Message: "An error has occurred.", ExceptionMessage: "Value cannot be null. Parameter name: key", ExceptionType: "System.ArgumentNullException", StackTrace: " at System.Collections.Generic.Dictionary
2.FindEntry(TKey key) at System.Collections.Generic.Dictionary
2.TryGetValue(TKey key, TValue& value) at Sitecore.Services.Infrastructure.Web.Http.Dispatcher.NamespaceHttpControllerSelector.SelectController(HttpRequestMessage request) at System.Web.Http.Dispatcher.HttpControllerDispatcher.SendAsyncCore(HttpRequestMessage request, CancellationToken cancellationToken) at System.Web.Http.Dispatcher.HttpControllerDispatcher.d__0.MoveNext()"
The code that I have in the application start is the following:
protected void Application_Start(object sender, EventArgs e)
{
GlobalConfiguration.Configure(ConfigureRoutes);
}
public static void ConfigureRoutes(HttpConfiguration config)
{
GlobalConfiguration.Configuration.MapHttpAttributeRoutes();
GlobalConfiguration.Configuration.Formatters.Clear();
GlobalConfiguration.Configuration.Formatters.Add(new JsonMediaTypeFormatter());
}
any help would be appreciated....