Custom webAPI routing missing assembly version of System.Net.Http?
I have tried to make a new custom webAPI route, but are this build error:
The type 'System.Net.Http.HttpMessageHandler' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Net.Http, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
My custom route i put inside a file called "UmbracoEvents.cs" in the App_Start folder. And the content looks like:
using System.Web.Http;
using System.Web.Routing;
using Umbraco.Core;
namespace XXX
{
public class UmbracoEvents : IApplicationEventHandler
{
public void OnApplicationInitialized(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
{
}
public void OnApplicationStarting(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
{
RouteTable.Routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "api/{controller}/{id}",
defaults: new { id = RouteParameter.Optional }
);
}
public void OnApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
{
}
}
}
Custom webAPI routing missing assembly version of System.Net.Http?
I have tried to make a new custom webAPI route, but are this build error:
My custom route i put inside a file called "UmbracoEvents.cs" in the App_Start folder. And the content looks like:
Can anybody spot the hot to fix?
Hi Jacob
Has the correct version been added to the references in your project?
/Jan
Of course!!
When i added to reference manually in VS the project whould build. Thanks
is working on a reply...