This repository was archived by the owner on Dec 18, 2018. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -104,11 +104,17 @@ public static Task Main(string[] args)
104
104
105
105
options . ListenLocalhost ( basePort + 2 , listenOptions =>
106
106
{
107
- listenOptions . UseHttps ( StoreName . My , "aspnet.test" , StoreLocation . CurrentUser ) ;
107
+ // Use default dev cert
108
+ listenOptions . UseHttps ( ) ;
108
109
} ) ;
109
110
110
111
options . ListenAnyIP ( basePort + 3 ) ;
111
112
113
+ options . ListenAnyIP ( basePort + 4 , listenOptions =>
114
+ {
115
+ listenOptions . UseHttps ( StoreName . My , "aspnet.test" , StoreLocation . CurrentUser ) ;
116
+ } ) ;
117
+
112
118
options . UseSystemd ( ) ;
113
119
114
120
// The following section should be used to demo sockets
Original file line number Diff line number Diff line change 5
5
using System . IO ;
6
6
using System . Security . Cryptography . X509Certificates ;
7
7
using Microsoft . AspNetCore . Server . Kestrel . Core ;
8
+ using Microsoft . AspNetCore . Server . Kestrel . Core . Internal ;
8
9
using Microsoft . AspNetCore . Server . Kestrel . Https ;
9
10
using Microsoft . AspNetCore . Server . Kestrel . Https . Internal ;
10
11
using Microsoft . Extensions . DependencyInjection ;
@@ -17,6 +18,18 @@ namespace Microsoft.AspNetCore.Hosting
17
18
/// </summary>
18
19
public static class ListenOptionsHttpsExtensions
19
20
{
21
+ /// <summary>
22
+ /// Configure Kestrel to use HTTPS with the default development certificate.
23
+ /// </summary>
24
+ /// <param name="listenOptions">The <see cref="ListenOptions"/> to configure.</param>
25
+ /// <returns>The <see cref="ListenOptions"/>.</returns>
26
+ public static ListenOptions UseHttps ( this ListenOptions listenOptions )
27
+ {
28
+ var httpsProvider = listenOptions . KestrelServerOptions . ApplicationServices . GetRequiredService < IDefaultHttpsProvider > ( ) ;
29
+ httpsProvider . ConfigureHttps ( listenOptions ) ;
30
+ return listenOptions ;
31
+ }
32
+
20
33
/// <summary>
21
34
/// Configure Kestrel to use HTTPS.
22
35
/// </summary>
You can’t perform that action at this time.
0 commit comments