13
13
using Microsoft . AspNetCore . Http ;
14
14
using Microsoft . AspNetCore . Testing ;
15
15
using Microsoft . Extensions . DependencyInjection ;
16
+ using Microsoft . Extensions . Hosting ;
16
17
using Microsoft . Extensions . Logging ;
17
18
using Microsoft . Extensions . Options ;
18
19
@@ -66,7 +67,7 @@ internal static IServer CreateHttpAuthServer(AuthenticationSchemes authType, boo
66
67
} , app ) ;
67
68
}
68
69
69
- internal static IWebHost CreateDynamicHost ( AuthenticationSchemes authType , bool allowAnonymous , out string root , RequestDelegate app )
70
+ internal static IHost CreateDynamicHost ( AuthenticationSchemes authType , bool allowAnonymous , out string root , RequestDelegate app )
70
71
{
71
72
return CreateDynamicHost ( string . Empty , out root , out var baseAddress , options =>
72
73
{
@@ -75,22 +76,26 @@ internal static IWebHost CreateDynamicHost(AuthenticationSchemes authType, bool
75
76
} , app ) ;
76
77
}
77
78
78
- internal static IWebHost CreateDynamicHost ( out string baseAddress , Action < HttpSysOptions > configureOptions , RequestDelegate app )
79
+ internal static IHost CreateDynamicHost ( out string baseAddress , Action < HttpSysOptions > configureOptions , RequestDelegate app )
79
80
{
80
81
return CreateDynamicHost ( string . Empty , out var root , out baseAddress , configureOptions , app ) ;
81
82
}
82
83
83
- internal static IWebHost CreateDynamicHost ( string basePath , out string root , out string baseAddress , Action < HttpSysOptions > configureOptions , RequestDelegate app )
84
+ internal static IHost CreateDynamicHost ( string basePath , out string root , out string baseAddress , Action < HttpSysOptions > configureOptions , RequestDelegate app )
84
85
{
85
86
var prefix = UrlPrefix . Create ( "http" , "localhost" , "0" , basePath ) ;
86
87
87
- var builder = new WebHostBuilder ( )
88
- . UseHttpSys ( options =>
88
+ var builder = new HostBuilder ( )
89
+ . ConfigureWebHost ( webHostBuilder =>
89
90
{
90
- options . UrlPrefixes . Add ( prefix ) ;
91
- configureOptions ( options ) ;
92
- } )
93
- . Configure ( appBuilder => appBuilder . Run ( app ) ) ;
91
+ webHostBuilder
92
+ . UseHttpSys ( options =>
93
+ {
94
+ options . UrlPrefixes . Add ( prefix ) ;
95
+ configureOptions ( options ) ;
96
+ } )
97
+ . Configure ( appBuilder => appBuilder . Run ( app ) ) ;
98
+ } ) ;
94
99
95
100
var host = builder . Build ( ) ;
96
101
0 commit comments