Dependency injection failure in ASP.NET Core RC2
<p>I am unable to start up my asp.net core application after trying to port it to 1.0 RC2  from 1.0 RC1.  The startup error I get is this:</p>

<pre><code>Unhandled Exception: System.Exception: Could not resolve a service of type 'Microsoft.Extensions.Configuration.IConfiguration' for the parameter 'configuration' of method 'Configure' on type 'MYCOMPANY.MYTHING.Api.Startup'.
   at Microsoft.AspNetCore.Hosting.Startup.ConfigureBuilder.Invoke(Object instance, IApplicationBuilder builder)
   at Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication()
   at Microsoft.AspNetCore.Hosting.WebHostBuilder.Build()
   at MYCOMPANY.MYTHING.Api.Program.Main(String[] args)
</code></pre>

<p>I can't figure out how this is supposed to work.</p>

<p>The parts I do understand are:</p>

<ul>
<li><p>My startup.cs code looks correct to me, in Startup(IHostingEnvironment env) I create a ConfigurationBuilder and set Startup.Configuration equal to builder.Build(). The ConfigureServices method is also reached and Configuration object exists there.</p></li>
<li><p>When the host.Run() code is reached in Program.cs, I get a crash.</p></li>
<li><p>Configure(app,env,loggerFactory,configuration,respository...) method is NEVER reached.</p></li>
<li><p>In RC1 there used to be a line like this:</p>

<pre><code>services.AddInstance&lt;IConfiguration&gt;(Configuration);
</code></pre></li>
<li><p>In RC2 that doesn't exist anymore in a new application (I am reading a new application which works and trying to compare line by line).</p></li>
</ul>

<p>I have been looking for how to make this work, and how to understand dependency injection of the IConfigurationRoot, but I don't see any attribute or code that seems to be responsible for this injection.</p>

<p>Update: It seems that I was using some strange pattern in my RC1 code that is no longer supported in RC2.  After I removed some additional parameters from my Configure() method it was once again invoked by the .net core startup code.</p>