{"action":"created","issue":{"url":"https://api.github.com/repos/aspnet/HttpAbstractions/issues/331","labels_url":"https://api.github.com/repos/aspnet/HttpAbstractions/issues/331/labels{/name}","comments_url":"https://api.github.com/repos/aspnet/HttpAbstractions/issues/331/comments","events_url":"https://api.github.com/repos/aspnet/HttpAbstractions/issues/331/events","html_url":"https://github.com/aspnet/HttpAbstractions/issues/331","id":89306497,"number":331,"title":"Pass params to middleware constructor","user":{"login":"kspearrin","id":1190944,"avatar_url":"https://avatars.githubusercontent.com/u/1190944?v=3","gravatar_id":"","url":"https://api.github.com/users/kspearrin","html_url":"https://github.com/kspearrin","followers_url":"https://api.github.com/users/kspearrin/followers","following_url":"https://api.github.com/users/kspearrin/following{/other_user}","gists_url":"https://api.github.com/users/kspearrin/gists{/gist_id}","starred_url":"https://api.github.com/users/kspearrin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kspearrin/subscriptions","organizations_url":"https://api.github.com/users/kspearrin/orgs","repos_url":"https://api.github.com/users/kspearrin/repos","events_url":"https://api.github.com/users/kspearrin/events{/privacy}","received_events_url":"https://api.github.com/users/kspearrin/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/aspnet/HttpAbstractions/labels/bug","name":"bug","color":"fc2929"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-06-18T14:20:55Z","updated_at":"2015-06-18T18:38:18Z","closed_at":null,"body":"I want to do this from `Startup.cs`:\r\n\r\n    app.UseMiddleware<MyMiddleware>( foo );\r\n\r\n`MyMiddleware` looks like this:\r\n\r\n    public class MyMiddleware\r\n    {\r\n        private readonly RequestDelegate m_next;\r\n\r\n        public MyMiddleware( RequestDelegate next, Foo foo )\r\n        {\r\n            m_next = next;\r\n            // use foo\r\n        }\r\n\r\n        public async Task Invoke( HttpContext httpContext )\r\n        {\r\n            await m_next( httpContext );\r\n        }\r\n    }\r\n\r\nYet I keep getting:\r\n\r\n>System.InvalidOperationException\r\n>Unable to locate suitable constructor for type 'MyMiddleware'. Ensure the type is concrete and all parameters are accepted by a constructor.\r\n\r\nHow do I pass additional parameters in my middleware constructor?"},"comment":{"url":"https://api.github.com/repos/aspnet/HttpAbstractions/issues/comments/113253007","html_url":"https://github.com/aspnet/HttpAbstractions/issues/331#issuecomment-113253007","issue_url":"https://api.github.com/repos/aspnet/HttpAbstractions/issues/331","id":113253007,"user":{"login":"kspearrin","id":1190944,"avatar_url":"https://avatars.githubusercontent.com/u/1190944?v=3","gravatar_id":"","url":"https://api.github.com/users/kspearrin","html_url":"https://github.com/kspearrin","followers_url":"https://api.github.com/users/kspearrin/followers","following_url":"https://api.github.com/users/kspearrin/following{/other_user}","gists_url":"https://api.github.com/users/kspearrin/gists{/gist_id}","starred_url":"https://api.github.com/users/kspearrin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kspearrin/subscriptions","organizations_url":"https://api.github.com/users/kspearrin/orgs","repos_url":"https://api.github.com/users/kspearrin/repos","events_url":"https://api.github.com/users/kspearrin/events{/privacy}","received_events_url":"https://api.github.com/users/kspearrin/received_events","type":"User","site_admin":false},"created_at":"2015-06-18T18:38:18Z","updated_at":"2015-06-18T18:38:18Z","body":"Got it working in beta4. Turns out `foo` can't be `null`."}}