{"action":"created","issue":{"url":"https://api.github.com/repos/aspnet/Hosting/issues/337","labels_url":"https://api.github.com/repos/aspnet/Hosting/issues/337/labels{/name}","comments_url":"https://api.github.com/repos/aspnet/Hosting/issues/337/comments","events_url":"https://api.github.com/repos/aspnet/Hosting/issues/337/events","html_url":"https://github.com/aspnet/Hosting/issues/337","id":102575613,"number":337,"title":"HostEngine Start not setting HttpContext.ApplicationServices - uses default DI provider","user":{"login":"BillKrat","id":10552946,"avatar_url":"https://avatars.githubusercontent.com/u/10552946?v=3","gravatar_id":"","url":"https://api.github.com/users/BillKrat","html_url":"https://github.com/BillKrat","followers_url":"https://api.github.com/users/BillKrat/followers","following_url":"https://api.github.com/users/BillKrat/following{/other_user}","gists_url":"https://api.github.com/users/BillKrat/gists{/gist_id}","starred_url":"https://api.github.com/users/BillKrat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BillKrat/subscriptions","organizations_url":"https://api.github.com/users/BillKrat/orgs","repos_url":"https://api.github.com/users/BillKrat/repos","events_url":"https://api.github.com/users/BillKrat/events{/privacy}","received_events_url":"https://api.github.com/users/BillKrat/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"HaoK","id":6537861,"avatar_url":"https://avatars.githubusercontent.com/u/6537861?v=3","gravatar_id":"","url":"https://api.github.com/users/HaoK","html_url":"https://github.com/HaoK","followers_url":"https://api.github.com/users/HaoK/followers","following_url":"https://api.github.com/users/HaoK/following{/other_user}","gists_url":"https://api.github.com/users/HaoK/gists{/gist_id}","starred_url":"https://api.github.com/users/HaoK/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HaoK/subscriptions","organizations_url":"https://api.github.com/users/HaoK/orgs","repos_url":"https://api.github.com/users/HaoK/repos","events_url":"https://api.github.com/users/HaoK/events{/privacy}","received_events_url":"https://api.github.com/users/HaoK/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/aspnet/Hosting/milestones/15","html_url":"https://github.com/aspnet/Hosting/milestones/1.0.0-beta8","labels_url":"https://api.github.com/repos/aspnet/Hosting/milestones/15/labels","id":1242517,"number":15,"title":"1.0.0-beta8","description":null,"creator":{"login":"glennc","id":234688,"avatar_url":"https://avatars.githubusercontent.com/u/234688?v=3","gravatar_id":"","url":"https://api.github.com/users/glennc","html_url":"https://github.com/glennc","followers_url":"https://api.github.com/users/glennc/followers","following_url":"https://api.github.com/users/glennc/following{/other_user}","gists_url":"https://api.github.com/users/glennc/gists{/gist_id}","starred_url":"https://api.github.com/users/glennc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/glennc/subscriptions","organizations_url":"https://api.github.com/users/glennc/orgs","repos_url":"https://api.github.com/users/glennc/repos","events_url":"https://api.github.com/users/glennc/events{/privacy}","received_events_url":"https://api.github.com/users/glennc/received_events","type":"User","site_admin":false},"open_issues":5,"closed_issues":0,"state":"open","created_at":"2015-08-05T17:59:15Z","updated_at":"2015-08-24T17:58:00Z","due_on":null,"closed_at":null},"comments":6,"created_at":"2015-08-22T23:53:35Z","updated_at":"2015-08-25T18:49:33Z","closed_at":null,"body":"I am returning a UnityServiceProvider from ConfigureServices and I can see that it is being set to the ApplicationServices property (above the HostingEngine.Start method in top right of image below), however the httpContext.ApplicationServices is null which causes it to use _services resulting in the default DI provider to be used.  I see the DefaultControllerActivator retrieves the HttpContext.RequestServices (default provider) resulting in my HomeController not resolving IFoo as expected (line 104 left pane) since it is not using my UnityServiceProvider.\r\n\r\nI am making assumptions based on the limited documentation available during internet research, but will be glad to blog the topic if I am missing something and you can elaborate...\r\n\r\nUPDATED: My work around was to add the following line in HostEngine.Start() that sets RequestServices as follows:\r\n\r\n                    using (logger.BeginScope(\"Request Id: {RequestId}\", requestIdentifier))\r\n                    {\r\n                        // BillKrat.2015.08.23 - work around so DI container is used\r\n                        httpContext.RequestServices = ApplicationServices;\r\n\r\n                        contextAccessor.HttpContext = httpContext;\r\n                        await application(httpContext);\r\n                    }\r\n\r\n![serviceprovider](https://cloud.githubusercontent.com/assets/10552946/9426301/634dcea8-48fd-11e5-83e7-a1cd91c81014.png)\r\n"},"comment":{"url":"https://api.github.com/repos/aspnet/Hosting/issues/comments/134699450","html_url":"https://github.com/aspnet/Hosting/issues/337#issuecomment-134699450","issue_url":"https://api.github.com/repos/aspnet/Hosting/issues/337","id":134699450,"user":{"login":"HaoK","id":6537861,"avatar_url":"https://avatars.githubusercontent.com/u/6537861?v=3","gravatar_id":"","url":"https://api.github.com/users/HaoK","html_url":"https://github.com/HaoK","followers_url":"https://api.github.com/users/HaoK/followers","following_url":"https://api.github.com/users/HaoK/following{/other_user}","gists_url":"https://api.github.com/users/HaoK/gists{/gist_id}","starred_url":"https://api.github.com/users/HaoK/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HaoK/subscriptions","organizations_url":"https://api.github.com/users/HaoK/orgs","repos_url":"https://api.github.com/users/HaoK/repos","events_url":"https://api.github.com/users/HaoK/events{/privacy}","received_events_url":"https://api.github.com/users/HaoK/received_events","type":"User","site_admin":false},"created_at":"2015-08-25T18:49:33Z","updated_at":"2015-08-25T18:49:33Z","body":"Ah okay yeah we tweaked this code a bit recently, so hopefully this was fixed already as part of that.  let me know if you still see issues once you've upgraded"}}