How to register an instance in ServiceCollection in ASP.NET Core 1.0 RC2

I am moving my web application from ASP.NET Core RC1 to RC2. RC2 IServiceCollection no longer has the AddInstance method. How to get a registered configuration?

Here's how it was done in RC1

 public class Startup { public IConfiguration Configuration { get; set; } public void ConfigureServices(IServiceCollection services) { // AddInstance doesn't exist services.AddInstance<IConfiguration>(Configuration); . . } } 
+12
source share
1 answer

try it:

 services.AddSingleton<IConfiguration>(Configuration); 

I had the same problem as you, and I solved it with that.

+22
source

All Articles