{"action":"created","issue":{"url":"https://api.github.com/repos/aspnet/KestrelHttpServer/issues/924","repository_url":"https://api.github.com/repos/aspnet/KestrelHttpServer","labels_url":"https://api.github.com/repos/aspnet/KestrelHttpServer/issues/924/labels{/name}","comments_url":"https://api.github.com/repos/aspnet/KestrelHttpServer/issues/924/comments","events_url":"https://api.github.com/repos/aspnet/KestrelHttpServer/issues/924/events","html_url":"https://github.com/aspnet/KestrelHttpServer/issues/924","id":159611414,"number":924,"title":"Kestrel send empty response over custom SSL","user":{"login":"Ph47","id":1222083,"avatar_url":"https://avatars.githubusercontent.com/u/1222083?v=3","gravatar_id":"","url":"https://api.github.com/users/Ph47","html_url":"https://github.com/Ph47","followers_url":"https://api.github.com/users/Ph47/followers","following_url":"https://api.github.com/users/Ph47/following{/other_user}","gists_url":"https://api.github.com/users/Ph47/gists{/gist_id}","starred_url":"https://api.github.com/users/Ph47/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Ph47/subscriptions","organizations_url":"https://api.github.com/users/Ph47/orgs","repos_url":"https://api.github.com/users/Ph47/repos","events_url":"https://api.github.com/users/Ph47/events{/privacy}","received_events_url":"https://api.github.com/users/Ph47/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":9,"created_at":"2016-06-10T11:04:43Z","updated_at":"2016-06-13T18:09:36Z","closed_at":null,"body":"I have constantly repeated exceptions:\r\n```\r\nMicrosoft.AspNetCore.Server.Kestrel, Version=1.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60: Error: ConnectionFilter.OnConnection\r\n\r\nSystem.AggregateException: One or more errors occurred. ---> System.IO.IOException: Authentication failed because the remote party has closed the transport stream.\r\n   at System.Net.Security.SslState.InternalEndProcessAuthentication(LazyAsyncResult lazyResult)\r\n   at System.Net.Security.SslState.EndProcessAuthentication(IAsyncResult result)\r\n   at System.Threading.Tasks.TaskFactory`1.FromAsyncCoreLogic(IAsyncResult iar, Func`2 endFunction, Action`1 endAction, Task`1 promise, Boolean requiresSynchronization)\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at Microsoft.AspNetCore.Server.Kestrel.Https.HttpsConnectionFilter.<OnConnectionAsync>d__3.MoveNext()\r\n   --- End of inner exception stack trace ---\r\n---> (Inner Exception #0) System.IO.IOException: Authentication failed because the remote party has closed the transport stream.\r\n   at System.Net.Security.SslState.InternalEndProcessAuthentication(LazyAsyncResult lazyResult)\r\n   at System.Net.Security.SslState.EndProcessAuthentication(IAsyncResult result)\r\n   at System.Threading.Tasks.TaskFactory`1.FromAsyncCoreLogic(IAsyncResult iar, Func`2 endFunction, Action`1 endAction, Task`1 promise, Boolean requiresSynchronization)\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at Microsoft.AspNetCore.Server.Kestrel.Https.HttpsConnectionFilter.<OnConnectionAsync>d__3.MoveNext()<---\r\n\r\nMicrosoft.AspNetCore.Server.Kestrel, Version=1.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60: Error: ConnectionFilter.OnConnection\r\n\r\nSystem.AggregateException: One or more errors occurred. ---> System.IO.IOException: The handshake failed due to an unexpected packet format.\r\n   at System.Net.Security.SslState.InternalEndProcessAuthentication(LazyAsyncResult lazyResult)\r\n   at System.Net.Security.SslState.EndProcessAuthentication(IAsyncResult result)\r\n   at System.Threading.Tasks.TaskFactory`1.FromAsyncCoreLogic(IAsyncResult iar, Func`2 endFunction, Action`1 endAction, Task`1 promise, Boolean requiresSynchronization)\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at Microsoft.AspNetCore.Server.Kestrel.Https.HttpsConnectionFilter.<OnConnectionAsync>d__3.MoveNext()\r\n   --- End of inner exception stack trace ---\r\n---> (Inner Exception #0) System.IO.IOException: The handshake failed due to an unexpected packet format.\r\n   at System.Net.Security.SslState.InternalEndProcessAuthentication(LazyAsyncResult lazyResult)\r\n   at System.Net.Security.SslState.EndProcessAuthentication(IAsyncResult result)\r\n   at System.Threading.Tasks.TaskFactory`1.FromAsyncCoreLogic(IAsyncResult iar, Func`2 endFunction, Action`1 endAction, Task`1 promise, Boolean requiresSynchronization)\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at Microsoft.AspNetCore.Server.Kestrel.Https.HttpsConnectionFilter.<OnConnectionAsync>d__3.MoveNext()<---\r\n```\r\nMy Main is like:\r\n```\r\n        public static void Main(string[] args)\r\n        {\r\n            ContainerBuilder builder = new ContainerBuilder();\r\n            string folder = Directory.GetCurrentDirectory() + \"\\\\\";\r\n\r\n            // register configuration\r\n            builder.RegisterInstance(\r\n                new ConfigurationBuilder()\r\n                    .SetBasePath(folder)\r\n                    .AddJsonFile(\"config.json\")\r\n                    .AddEnvironmentVariables()\r\n                    .AddCommandLine(args)\r\n                    .Build()\r\n                ).As<IConfiguration>();\r\n\r\n            Container = builder.Build();\r\n\r\n            X509Certificate2 httpsCert = new X509Certificate2(folder + Container.Resolve<IConfiguration>()[\"Hosting:PfxPath\"], Container.Resolve<IConfiguration>()[\"Hosting:PfxPassword\"]);\r\n                        \r\n\r\n            // build and launch web server\r\n            new WebHostBuilder()\r\n                .UseConfiguration(Container.Resolve<IConfiguration>())\r\n                .UseContentRoot(folder)                \r\n                .UseKestrel(options => {\r\n                    options.NoDelay = true;\r\n                    options.UseHttps(new HttpsConnectionFilterOptions() {\r\n                         ServerCertificate = httpsCert,\r\n                         SslProtocols = SslProtocols.Tls12\r\n                    });\r\n                })\r\n                .UseUrls(Container.Resolve<IConfiguration>()[\"Hosting:HttpUrl\"], Container.Resolve<IConfiguration>()[\"Hosting:HttpsUrl\"])\r\n                .UseStartup<Startup>()\r\n                .Build()\r\n                .Run();\r\n        }     \r\n```\r\nMy project.json:\r\n```\r\n{\r\n  \"dependencies\": {\r\n    \"Autofac\": \"4.0.0-*\",\r\n    \"Hangfire\": \"1.5.4\",\r\n    \"Hangfire.Autofac\": \"2.2.0\",\r\n    \"HttpMultipartParser\": \"2.1.3\",\r\n    \"ImageProcessor\": \"2.3.3\",\r\n    \"Lucene.Net\": \"3.0.3\",\r\n    \"AutoMapper\": \"4.2.1\",\r\n    \"NReco.PdfGenerator\": \"1.1.12\",\r\n    \"MySql.Data\": \"6.9.8\",\r\n    \"Nancy\": \"1.4.3\",\r\n    \"Nancy.Validation.DataAnnotations\": \"1.4.1\",\r\n    \"Nancy.Owin\": \"1.4.1\",\r\n    \"Nancy.Bootstrappers.Autofac\": \"1.4.1\",\r\n    \"Newtonsoft.Json\": \"8.0.3\",\r\n    \"Nancy.Serialization.JsonNet\": \"1.4.1\",\r\n    \"MailKit\": \"1.2.23\",\r\n    \"IdentityServer3\": \"2.5.0\",\r\n\r\n    \"Microsoft.AspNetCore.StaticFiles\": \"1.0.0-rc2-final\",\r\n    \"Microsoft.AspNetCore.Diagnostics\": \"1.0.0-rc2-final\",\r\n    \"Microsoft.AspNetCore.Owin\": \"1.0.0-rc2-final\",\r\n    \"Microsoft.AspNetCore.Server.Kestrel\": \"1.0.0-rc2-final\",\r\n    \"Microsoft.AspNetCore.Server.Kestrel.Https\": \"1.0.0-rc2-final\",\r\n\r\n    \"Microsoft.EntityFrameworkCore\": \"1.0.0-rc2-final\",\r\n    \"Microsoft.EntityFrameworkCore.SqlServer\": \"1.0.0-rc2-final\",\r\n\r\n    \"Microsoft.Extensions.Configuration\": \"1.0.0-rc2-final\",\r\n    \"Microsoft.Extensions.Configuration.CommandLine\": \"1.0.0-rc2-final\",\r\n    \"Microsoft.Extensions.Configuration.EnvironmentVariables\": \"1.0.0-rc2-final\",\r\n    \"Microsoft.Extensions.Configuration.Json\": \"1.0.0-rc2-final\",\r\n    \"Microsoft.Extensions.Logging\": \"1.0.0-rc2-final\",\r\n    \"Microsoft.Extensions.Logging.Console\": \"1.0.0-rc2-final\",\r\n    \"Microsoft.Extensions.Logging.Debug\": \"1.0.0-rc2-final\",\r\n    \"Microsoft.Extensions.Options\": \"1.0.0-rc2-final\",\r\n    \"Microsoft.Extensions.PlatformAbstractions\": \"1.0.0-rc2-final\",\r\n    \"Autofac.Extensions.DependencyInjection\": \"4.0.0-*\"\r\n  },\r\n\r\n  \"tools\": {\r\n    \"Microsoft.AspNetCore.Server.IISIntegration.Tools\": {\r\n      \"version\": \"1.0.0-preview1-final\",\r\n      \"imports\": \"portable-net45+win8+dnxcore50\"\r\n    }\r\n  },\r\n\r\n  \"frameworks\": {\r\n    \"net461\": {\r\n      \"frameworkAssemblies\": {\r\n        \"System.Runtime\": \"\",\r\n        \"System.Runtime.Serialization\": \"\",\r\n        \"System.Runtime.Serialization.Primitives\": \"\",\r\n        \"System.Reflection\": \"\",\r\n        \"System.Data\": \"\",\r\n        \"System.ComponentModel\": \"\",\r\n        \"System.Drawing\": \"\",\r\n        \"System.Collections\": \"\"\r\n      }\r\n    }\r\n  },\r\n\r\n  \"buildOptions\": {\r\n    \"emitEntryPoint\": true,\r\n    \"preserveCompilationContext\": true\r\n  },\r\n\r\n  \"publishOptions\": {\r\n    \"include\": [\r\n      \"wwwroot\",\r\n      \"web.config\",\r\n      \"cert.pfx\",\r\n      \"config.json\"\r\n    ]\r\n  },\r\n\r\n  \"scripts\": {\r\n    \"postpublish\": [ \"dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%\" ]\r\n  }\r\n}\r\n```\r\nMy config contains:\r\n```\r\n  \"Hosting\": {\r\n    \"HttpUrl\": \"http://localhost:4748/\",\r\n    \"HttpsUrl\": \"https://localhost:4747/\",\r\n    \"PfxPath\": \"cert.pfx\",\r\n    \"PfxPassword\": \"testPassword\"\r\n  },\r\n```\r\n\r\nI trieed:\r\n- many different certs include test one in samples folder;\r\n- admin / user rights;\r\n- install certs into different locations;\r\n- all SslProtocols avaiable;\r\n- VS and console dotnet run.\r\nMy windows is 8 x64. I am using 4747 tcp port.\r\n\r\nUPD: when i am trying UseConnectionLogging and Null Exception throw. It is strange behavior.\r\nUPD: i tried different ports (and 443) and it is same exception."},"comment":{"url":"https://api.github.com/repos/aspnet/KestrelHttpServer/issues/comments/225662147","html_url":"https://github.com/aspnet/KestrelHttpServer/issues/924#issuecomment-225662147","issue_url":"https://api.github.com/repos/aspnet/KestrelHttpServer/issues/924","id":225662147,"user":{"login":"Ph47","id":1222083,"avatar_url":"https://avatars.githubusercontent.com/u/1222083?v=3","gravatar_id":"","url":"https://api.github.com/users/Ph47","html_url":"https://github.com/Ph47","followers_url":"https://api.github.com/users/Ph47/followers","following_url":"https://api.github.com/users/Ph47/following{/other_user}","gists_url":"https://api.github.com/users/Ph47/gists{/gist_id}","starred_url":"https://api.github.com/users/Ph47/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Ph47/subscriptions","organizations_url":"https://api.github.com/users/Ph47/orgs","repos_url":"https://api.github.com/users/Ph47/repos","events_url":"https://api.github.com/users/Ph47/events{/privacy}","received_events_url":"https://api.github.com/users/Ph47/received_events","type":"User","site_admin":false},"created_at":"2016-06-13T18:09:35Z","updated_at":"2016-06-13T18:09:35Z","body":"My workaround while issue in Autofac discussed listed below:\r\n```\r\n#region Autofac integration\r\n   ContainerBuilder servicesUpdateBuilder = new ContainerBuilder();\r\n   servicesUpdateBuilder.Populate(services.Reverse());\r\n   servicesUpdateBuilder.Update(Container);\r\n   return Container.Resolve<IServiceProvider>();\r\n#endregion\r\n```\r\nhttps://msdn.microsoft.com/en-us/library/bb358497(v=vs.100).aspx"}}
{"actor":{"display_login":"Ph47"}}