In RC1, IUrlHelper could be injected in services (with services.AddMvc() in startup class)
This doesn\'t work anymore in <
For ASP.NET Core RC2 there is an issue for this on the github repo. Instead of injecting the IUrlHelper, take an IUrlHelperFactory. It also sounds like you'd need the IActionContextAccessor injected as a Controller no longer has a public property ActionContext.
Register the dependency:
services.AddSingleton();
Then depend on it:
public SomeService(IUrlHelperFactory urlHelperFactory,
IActionContextAccessor actionContextAccessor)
{
var urlHelper =
urlHelperFactory.GetUrlHelper(actionContextAccessor.ActionContext);
}
Then use it as you see fit.