{"action":"opened","issue":{"url":"https://api.github.com/repos/aspnet/Hosting/issues/286","labels_url":"https://api.github.com/repos/aspnet/Hosting/issues/286/labels{/name}","comments_url":"https://api.github.com/repos/aspnet/Hosting/issues/286/comments","events_url":"https://api.github.com/repos/aspnet/Hosting/issues/286/events","html_url":"https://github.com/aspnet/Hosting/issues/286","id":82554490,"number":286,"title":"Decouple service discovery from Hosting","user":{"login":"bricelam","id":1226749,"avatar_url":"https://avatars.githubusercontent.com/u/1226749?v=3","gravatar_id":"","url":"https://api.github.com/users/bricelam","html_url":"https://github.com/bricelam","followers_url":"https://api.github.com/users/bricelam/followers","following_url":"https://api.github.com/users/bricelam/following{/other_user}","gists_url":"https://api.github.com/users/bricelam/gists{/gist_id}","starred_url":"https://api.github.com/users/bricelam/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bricelam/subscriptions","organizations_url":"https://api.github.com/users/bricelam/orgs","repos_url":"https://api.github.com/users/bricelam/repos","events_url":"https://api.github.com/users/bricelam/events{/privacy}","received_events_url":"https://api.github.com/users/bricelam/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-05-29T19:29:10Z","updated_at":"2015-05-29T19:29:10Z","closed_at":null,"body":"As mentioned in aspnet/EntityFramework#2136 and aspnet/EntityFramework#2020, we should try to decouple the discovery of services using `Startup.ConfigureServices()` from the rest of Hosting. Maybe it should be part of DependencyInjection.\r\n\r\nService discovery is used by the EF Migrations tooling to get the IServiceProvider to pass into the DbContext at design-time. Clearly, this doesn't require setting up the request pipeline or any of the other things handled by Hosting.\r\n\r\n@HaoK did make a good point...\r\n\r\n> I'm not sure we can, since Startup potentially can take things like IHostingEnvironment in its ctor which only come from hosting.\r\n\r\n...but to me, that feels like we have too much coupling between the components involved in startup."}}