I have a Service Fabric with a stateless service following the gateway pattern listening for HTTP requests and then forwarding them to the business logic in the cluster. That works great. Now I'm trying to add HTTPS support. The gateway project is using ASP.NET Core 1.0 (on NET461) and I'm on Service Fabric SDK 5.1.150, Visual Studio 2015 Update 3. If I start the gateway project manually (set as startup project) then I can hit the HTTPS endpoint, but when I run it via the cluster then the port is open, but it closes right away, I'm getting "localhost unexpectedly closed the connection." in Chrome. Here's my startup code:
builder
.UseKestrel(options =>
{
options.NoDelay = true;
options.ThreadCount = 1024;
if (sslCert != null)
{
options.UseHttps(sslCert);
}
})
.UseUrls("http://*:5402", "https://*:5403")
.UseContentRoot(System.IO.Directory.GetCurrentDirectory())
.UseStartup<Startup>()
.Build()
.Run();
What may be unique is that I'm trying to use Kestrel, but I've followed a sample using this (except that the sample didn't do HTTPS). The sslCert variable is set, again if I run it with this project as a startup project in VS then I can handle the HTTPS requests.
I have configured the endpoint in the cluster, but it doesn't seem to make a difference, I can still hit the tcp port if I leave it out. Any suggestions/samples?