Get injected IOptions <AppSettings>

I am trying to create my first ASP.NET vNext web application and the problem I am facing is that I cannot get IOptions<AppSettings>

injected into my method Startup.Configure()

. The weird thing is that the MVC sample site that was generated by VS2015 does the same steps, but the same injection works! Both projects run on the desktop CLR and use 1.0.0-beta4 binaries. I created a gist with my project files. I would appreciate any guidance or help on this.

+3


source to share


1 answer


In your ConfigureServices method, try adding the following:

services.AddOptions()



This registers OptionsManager<>

which is used to resolve services type IOptions<>

.

+6


source







All Articles