diff --git a/Hosting.sln b/Hosting.sln
index f61f83d7..e89e3ecc 100644
--- a/Hosting.sln
+++ b/Hosting.sln
@@ -34,8 +34,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.Hostin
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Hosting.WindowsServices", "src\Microsoft.AspNetCore.Hosting.WindowsServices\Microsoft.AspNetCore.Hosting.WindowsServices.csproj", "{9C93A93B-270A-4785-8F41-46C38DC33825}"
EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Certificates.Configuration", "src\Microsoft.AspNetCore.Certificates.Configuration\Microsoft.AspNetCore.Certificates.Configuration.csproj", "{A911A891-EAC5-4AA1-B17E-B83A1BB1E8B4}"
-EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Certificates.Configuration.Tests", "test\Microsoft.AspNetCore.Certificates.Configuration.Tests\Microsoft.AspNetCore.Certificates.Configuration.Tests.csproj", "{AB0B7394-278D-4838-A59C-276ED88D00CC}"
EndProject
Global
@@ -196,18 +194,6 @@ Global
{9C93A93B-270A-4785-8F41-46C38DC33825}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{9C93A93B-270A-4785-8F41-46C38DC33825}.Release|x86.ActiveCfg = Release|Any CPU
{9C93A93B-270A-4785-8F41-46C38DC33825}.Release|x86.Build.0 = Release|Any CPU
- {A911A891-EAC5-4AA1-B17E-B83A1BB1E8B4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {A911A891-EAC5-4AA1-B17E-B83A1BB1E8B4}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {A911A891-EAC5-4AA1-B17E-B83A1BB1E8B4}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
- {A911A891-EAC5-4AA1-B17E-B83A1BB1E8B4}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
- {A911A891-EAC5-4AA1-B17E-B83A1BB1E8B4}.Debug|x86.ActiveCfg = Debug|Any CPU
- {A911A891-EAC5-4AA1-B17E-B83A1BB1E8B4}.Debug|x86.Build.0 = Debug|Any CPU
- {A911A891-EAC5-4AA1-B17E-B83A1BB1E8B4}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {A911A891-EAC5-4AA1-B17E-B83A1BB1E8B4}.Release|Any CPU.Build.0 = Release|Any CPU
- {A911A891-EAC5-4AA1-B17E-B83A1BB1E8B4}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
- {A911A891-EAC5-4AA1-B17E-B83A1BB1E8B4}.Release|Mixed Platforms.Build.0 = Release|Any CPU
- {A911A891-EAC5-4AA1-B17E-B83A1BB1E8B4}.Release|x86.ActiveCfg = Release|Any CPU
- {A911A891-EAC5-4AA1-B17E-B83A1BB1E8B4}.Release|x86.Build.0 = Release|Any CPU
{AB0B7394-278D-4838-A59C-276ED88D00CC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AB0B7394-278D-4838-A59C-276ED88D00CC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AB0B7394-278D-4838-A59C-276ED88D00CC}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
@@ -238,7 +224,6 @@ Global
{39D3B138-37DB-4D03-A5A0-3F2B02EFC671} = {FEB39027-9158-4DE2-997F-7ADAEF8188D0}
{96BC7EEA-64D9-4DA5-8E87-1C18CBFE7D12} = {E0497F39-AFFB-4819-A116-E39E361915AB}
{9C93A93B-270A-4785-8F41-46C38DC33825} = {E0497F39-AFFB-4819-A116-E39E361915AB}
- {A911A891-EAC5-4AA1-B17E-B83A1BB1E8B4} = {E0497F39-AFFB-4819-A116-E39E361915AB}
{AB0B7394-278D-4838-A59C-276ED88D00CC} = {FEB39027-9158-4DE2-997F-7ADAEF8188D0}
EndGlobalSection
EndGlobal
diff --git a/NuGetPackageVerifier.json b/NuGetPackageVerifier.json
index cfea4cf1..48868ff0 100644
--- a/NuGetPackageVerifier.json
+++ b/NuGetPackageVerifier.json
@@ -4,6 +4,7 @@
// Don't run any rules for packages that don't ship.
],
"packages": {
+ "Microsoft.AspNetCore.Certificates.Configuration.Sources": {},
"Microsoft.AspNetCore.Server.IntegrationTesting": {}
}
},
diff --git a/src/Microsoft.AspNetCore.Certificates.Configuration/CertificateFileLoader.cs b/shared/Microsoft.AspNetCore.Certificates.Configuration.Sources/CertificateFileLoader.cs
similarity index 100%
rename from src/Microsoft.AspNetCore.Certificates.Configuration/CertificateFileLoader.cs
rename to shared/Microsoft.AspNetCore.Certificates.Configuration.Sources/CertificateFileLoader.cs
diff --git a/src/Microsoft.AspNetCore.Certificates.Configuration/CertificateLoader.cs b/shared/Microsoft.AspNetCore.Certificates.Configuration.Sources/CertificateLoader.cs
similarity index 95%
rename from src/Microsoft.AspNetCore.Certificates.Configuration/CertificateLoader.cs
rename to shared/Microsoft.AspNetCore.Certificates.Configuration.Sources/CertificateLoader.cs
index 03c2f888..83c78634 100644
--- a/src/Microsoft.AspNetCore.Certificates.Configuration/CertificateLoader.cs
+++ b/shared/Microsoft.AspNetCore.Certificates.Configuration.Sources/CertificateLoader.cs
@@ -13,7 +13,7 @@ namespace Microsoft.AspNetCore.Certificates.Configuration
///
/// A helper class to load certificates from files and certificate stores based on data.
///
- public class CertificateLoader
+ internal class CertificateLoader
{
private readonly IConfiguration _certificatesConfiguration;
private readonly string _environmentName;
@@ -25,7 +25,7 @@ public class CertificateLoader
/// Creates a new instance of that can load certificate references from configuration.
///
/// An with information about certificates.
- public CertificateLoader(IConfiguration certificatesConfiguration)
+ internal CertificateLoader(IConfiguration certificatesConfiguration)
: this(certificatesConfiguration, null, null)
{
}
@@ -35,7 +35,7 @@ public CertificateLoader(IConfiguration certificatesConfiguration)
///
/// An with information about certificates.
/// An instance.
- public CertificateLoader(IConfiguration certificatesConfiguration, ILoggerFactory loggerFactory)
+ internal CertificateLoader(IConfiguration certificatesConfiguration, ILoggerFactory loggerFactory)
: this(certificatesConfiguration, loggerFactory, null)
{
}
@@ -46,7 +46,7 @@ public CertificateLoader(IConfiguration certificatesConfiguration, ILoggerFactor
/// An with information about certificates.
/// An instance.
/// The name of the environment the application is running in.
- public CertificateLoader(IConfiguration certificatesConfiguration, ILoggerFactory loggerFactory, string environmentName)
+ internal CertificateLoader(IConfiguration certificatesConfiguration, ILoggerFactory loggerFactory, string environmentName)
: this(certificatesConfiguration, loggerFactory, environmentName, new CertificateFileLoader(), new CertificateStoreLoader())
{
}
@@ -72,7 +72,7 @@ internal CertificateLoader(
/// by name, or one or more inline certificate specifications.
///
/// One or more loaded certificates.
- public IEnumerable Load(IConfigurationSection certificateConfiguration)
+ internal IEnumerable Load(IConfigurationSection certificateConfiguration)
{
var certificateNames = certificateConfiguration.Value;
var certificates = new List();
@@ -182,6 +182,7 @@ public override X509Certificate2 Load()
#if NETCOREAPP2_0
?? TryLoad(X509KeyStorageFlags.EphemeralKeySet, out error)
#elif NETSTANDARD2_0
+#elif NET461
#else
#error target frameworks need to be updated
#endif
diff --git a/src/Microsoft.AspNetCore.Certificates.Configuration/CertificateStoreLoader.cs b/shared/Microsoft.AspNetCore.Certificates.Configuration.Sources/CertificateStoreLoader.cs
similarity index 97%
rename from src/Microsoft.AspNetCore.Certificates.Configuration/CertificateStoreLoader.cs
rename to shared/Microsoft.AspNetCore.Certificates.Configuration.Sources/CertificateStoreLoader.cs
index 1329fd44..c5af4e3f 100644
--- a/src/Microsoft.AspNetCore.Certificates.Configuration/CertificateStoreLoader.cs
+++ b/shared/Microsoft.AspNetCore.Certificates.Configuration.Sources/CertificateStoreLoader.cs
@@ -9,7 +9,7 @@ namespace Microsoft.AspNetCore.Certificates.Configuration
///
/// Loads certificates from certificate stores.
///
- public class CertificateStoreLoader : ICertificateStoreLoader
+ internal class CertificateStoreLoader : ICertificateStoreLoader
{
///
/// Load a ceritificate from the given store location.
diff --git a/src/Microsoft.AspNetCore.Certificates.Configuration/ICertificateFileLoader.cs b/shared/Microsoft.AspNetCore.Certificates.Configuration.Sources/ICertificateFileLoader.cs
similarity index 100%
rename from src/Microsoft.AspNetCore.Certificates.Configuration/ICertificateFileLoader.cs
rename to shared/Microsoft.AspNetCore.Certificates.Configuration.Sources/ICertificateFileLoader.cs
diff --git a/src/Microsoft.AspNetCore.Certificates.Configuration/ICertificateStoreLoader.cs b/shared/Microsoft.AspNetCore.Certificates.Configuration.Sources/ICertificateStoreLoader.cs
similarity index 100%
rename from src/Microsoft.AspNetCore.Certificates.Configuration/ICertificateStoreLoader.cs
rename to shared/Microsoft.AspNetCore.Certificates.Configuration.Sources/ICertificateStoreLoader.cs
diff --git a/src/Microsoft.AspNetCore.Certificates.Configuration/Microsoft.AspNetCore.Certificates.Configuration.csproj b/src/Microsoft.AspNetCore.Certificates.Configuration/Microsoft.AspNetCore.Certificates.Configuration.csproj
deleted file mode 100644
index 5275d54e..00000000
--- a/src/Microsoft.AspNetCore.Certificates.Configuration/Microsoft.AspNetCore.Certificates.Configuration.csproj
+++ /dev/null
@@ -1,17 +0,0 @@
-
-
-
-
-
- netcoreapp2.0;netstandard2.0
- aspnetcore;certificates
- Helpers for loading certificates from configuration.
- true
-
-
-
-
-
-
-
-
diff --git a/src/Microsoft.AspNetCore.Hosting.Abstractions/IWebHostBuilder.cs b/src/Microsoft.AspNetCore.Hosting.Abstractions/IWebHostBuilder.cs
index bb065922..2cf3bc11 100644
--- a/src/Microsoft.AspNetCore.Hosting.Abstractions/IWebHostBuilder.cs
+++ b/src/Microsoft.AspNetCore.Hosting.Abstractions/IWebHostBuilder.cs
@@ -29,20 +29,6 @@ public interface IWebHostBuilder
///
IWebHostBuilder ConfigureAppConfiguration(Action configureDelegate);
- ///
- /// Adds a delegate for configuring the provided . This may be called multiple times.
- ///
- /// The delegate that configures the .
- ///
- /// The type of to configure.
- /// The delegate will not execute if the type provided does not match the used by the .
- ///
- /// The .
- ///
- /// The on the is uninitialized at this stage.
- ///
- IWebHostBuilder ConfigureLogging(Action configureLogging) where T : ILoggerFactory;
-
///
/// Adds a delegate for configuring additional services for the host or web application. This may be called
/// multiple times.
@@ -73,23 +59,5 @@ public interface IWebHostBuilder
/// The value of the setting to add or replace.
/// The .
IWebHostBuilder UseSetting(string key, string value);
-
- ///
- /// Specify the to be used by the web host.
- ///
- /// The to be used.
- /// The .
- IWebHostBuilder UseLoggerFactory(ILoggerFactory loggerFactory);
-
- ///
- /// Adds a delegate to construct the that will be registered
- /// as a singleton and used by the application.
- ///
- /// The delegate that constructs an
- /// The .
- ///
- /// The on the is uninitialized at this stage.
- ///
- IWebHostBuilder UseLoggerFactory(Func createLoggerFactory);
}
}
\ No newline at end of file
diff --git a/src/Microsoft.AspNetCore.Hosting.Abstractions/WebHostBuilderContext.cs b/src/Microsoft.AspNetCore.Hosting.Abstractions/WebHostBuilderContext.cs
index 5a973abd..071479c7 100644
--- a/src/Microsoft.AspNetCore.Hosting.Abstractions/WebHostBuilderContext.cs
+++ b/src/Microsoft.AspNetCore.Hosting.Abstractions/WebHostBuilderContext.cs
@@ -20,10 +20,5 @@ public class WebHostBuilderContext
/// The containing the merged configuration of the application and the .
///
public IConfiguration Configuration { get; set; }
-
- ///
- /// The configured on the .
- ///
- public ILoggerFactory LoggerFactory { get; set; }
}
}
diff --git a/src/Microsoft.AspNetCore.Hosting.Abstractions/breakingchanges.netcore.json b/src/Microsoft.AspNetCore.Hosting.Abstractions/breakingchanges.netcore.json
index 4df8dcfa..e523c484 100644
--- a/src/Microsoft.AspNetCore.Hosting.Abstractions/breakingchanges.netcore.json
+++ b/src/Microsoft.AspNetCore.Hosting.Abstractions/breakingchanges.netcore.json
@@ -9,21 +9,11 @@
"MemberId": "Microsoft.AspNetCore.Hosting.IWebHostBuilder ConfigureAppConfiguration(System.Action configureDelegate)",
"Kind": "Addition"
},
- {
- "TypeId": "public interface Microsoft.AspNetCore.Hosting.IWebHostBuilder",
- "MemberId": "Microsoft.AspNetCore.Hosting.IWebHostBuilder ConfigureLogging(System.Action configureLogging) where T0 : Microsoft.Extensions.Logging.ILoggerFactory",
- "Kind": "Addition"
- },
{
"TypeId": "public interface Microsoft.AspNetCore.Hosting.IWebHostBuilder",
"MemberId": "Microsoft.AspNetCore.Hosting.IWebHostBuilder ConfigureServices(System.Action configureServices)",
"Kind": "Addition"
},
- {
- "TypeId": "public interface Microsoft.AspNetCore.Hosting.IWebHostBuilder",
- "MemberId": "Microsoft.AspNetCore.Hosting.IWebHostBuilder UseLoggerFactory(System.Func createLoggerFactory)",
- "Kind": "Addition"
- },
{
"TypeId": "public interface Microsoft.AspNetCore.Hosting.IWebHost : System.IDisposable",
"MemberId": "System.Threading.Tasks.Task StartAsync(System.Threading.CancellationToken cancellationToken)",
@@ -38,5 +28,10 @@
"TypeId": "public interface Microsoft.AspNetCore.Hosting.IWebHostBuilder",
"MemberId": "Microsoft.AspNetCore.Hosting.IWebHostBuilder ConfigureLogging(System.Action configureLogging)",
"Kind": "Removal"
- }
-]
\ No newline at end of file
+ },
+ {
+ "TypeId": "public interface Microsoft.AspNetCore.Hosting.IWebHostBuilder",
+ "MemberId": "Microsoft.AspNetCore.Hosting.IWebHostBuilder UseLoggerFactory(Microsoft.Extensions.Logging.ILoggerFactory loggerFactory)",
+ "Kind": "Removal"
+ }
+]
diff --git a/src/Microsoft.AspNetCore.Hosting/WebHostBuilder.cs b/src/Microsoft.AspNetCore.Hosting/WebHostBuilder.cs
index fdebde31..a2e06706 100644
--- a/src/Microsoft.AspNetCore.Hosting/WebHostBuilder.cs
+++ b/src/Microsoft.AspNetCore.Hosting/WebHostBuilder.cs
@@ -25,13 +25,11 @@ public class WebHostBuilder : IWebHostBuilder
{
private readonly IHostingEnvironment _hostingEnvironment;
private readonly List> _configureServicesDelegates;
- private readonly List> _configureLoggingDelegates;
private IConfiguration _config;
private WebHostOptions _options;
private WebHostBuilderContext _context;
private bool _webHostBuilt;
- private Func _createLoggerFactoryDelegate;
private List> _configureAppConfigurationBuilderDelegates;
///
@@ -41,7 +39,6 @@ public WebHostBuilder()
{
_hostingEnvironment = new HostingEnvironment();
_configureServicesDelegates = new List>();
- _configureLoggingDelegates = new List>();
_configureAppConfigurationBuilderDelegates = new List>();
_config = new ConfigurationBuilder()
@@ -89,41 +86,6 @@ public IWebHostBuilder UseSetting(string key, string value)
return this;
}
- ///
- /// Specify the to be used by the web host.
- ///
- /// The to be used.
- /// The .
- public IWebHostBuilder UseLoggerFactory(ILoggerFactory loggerFactory)
- {
- if (loggerFactory == null)
- {
- throw new ArgumentNullException(nameof(loggerFactory));
- }
-
- return UseLoggerFactory(_ => loggerFactory);
- }
-
- ///
- /// Adds a delegate to construct the that will be registered
- /// as a singleton and used by the application.
- ///
- /// The delegate that constructs an
- /// The .
- ///
- /// The on the is uninitialized at this stage.
- ///
- public IWebHostBuilder UseLoggerFactory(Func createLoggerFactory)
- {
- if (createLoggerFactory == null)
- {
- throw new ArgumentNullException(nameof(createLoggerFactory));
- }
-
- _createLoggerFactoryDelegate = createLoggerFactory;
- return this;
- }
-
///
/// Adds a delegate for configuring additional services for the host or web application. This may be called
/// multiple times.
@@ -157,35 +119,6 @@ public IWebHostBuilder ConfigureServices(Action
- /// Adds a delegate for configuring the provided . This may be called multiple times.
- ///
- /// The delegate that configures the .
- ///
- /// The type of to configure.
- /// The delegate will not execute if the type provided does not match the used by the .
- ///
- /// The .
- ///
- /// The on the is uninitialized at this stage.
- ///
- public IWebHostBuilder ConfigureLogging(Action configureLogging) where T : ILoggerFactory
- {
- if (configureLogging == null)
- {
- throw new ArgumentNullException(nameof(configureLogging));
- }
-
- _configureLoggingDelegates.Add((context, factory) =>
- {
- if (factory is T typedFactory)
- {
- configureLogging(context, typedFactory);
- }
- });
- return this;
- }
-
///
/// Adds a delegate for configuring the that will construct an .
///
@@ -311,19 +244,6 @@ private IServiceCollection BuildCommonServices(out AggregateException hostingSta
services.AddSingleton(configuration);
_context.Configuration = configuration;
- // The configured ILoggerFactory is added as a singleton here. AddLogging below will not add an additional one.
- var loggerFactory = _createLoggerFactoryDelegate?.Invoke(_context) ?? new LoggerFactory();
- services.AddSingleton(loggerFactory);
- _context.LoggerFactory = loggerFactory;
-
- foreach (var configureLogging in _configureLoggingDelegates)
- {
- configureLogging(_context, loggerFactory);
- }
-
- //This is required to add ILogger of T.
- services.AddLogging();
-
var listener = new DiagnosticListener("Microsoft.AspNetCore");
services.AddSingleton(listener);
services.AddSingleton(listener);
@@ -332,6 +252,7 @@ private IServiceCollection BuildCommonServices(out AggregateException hostingSta
services.AddTransient();
services.AddScoped();
services.AddOptions();
+ services.AddLogging();
// Conjure up a RequestServices
services.AddTransient();
@@ -385,9 +306,6 @@ private void AddApplicationServices(IServiceCollection services, IServiceProvide
// can still manage their lifetime (disposal) shared instances with application services.
// NOTE: This code overrides original services lifetime. Instances would always be singleton in
// application container.
- var loggerFactory = hostingServiceProvider.GetService();
- services.Replace(ServiceDescriptor.Singleton(typeof(ILoggerFactory), loggerFactory));
-
var listener = hostingServiceProvider.GetService();
services.Replace(ServiceDescriptor.Singleton(typeof(DiagnosticListener), listener));
services.Replace(ServiceDescriptor.Singleton(typeof(DiagnosticSource), listener));
diff --git a/src/Microsoft.AspNetCore.Hosting/WebHostBuilderExtensions.cs b/src/Microsoft.AspNetCore.Hosting/WebHostBuilderExtensions.cs
index 213664bc..8427d51e 100644
--- a/src/Microsoft.AspNetCore.Hosting/WebHostBuilderExtensions.cs
+++ b/src/Microsoft.AspNetCore.Hosting/WebHostBuilderExtensions.cs
@@ -111,11 +111,11 @@ public static IWebHostBuilder UseDefaultServiceProvider(this IWebHostBuilder hos
/// Adds a delegate for configuring the provided . This may be called multiple times.
///
/// The to configure.
- /// The delegate that configures the .
+ /// The delegate that configures the .
/// The .
- public static IWebHostBuilder ConfigureLogging(this IWebHostBuilder hostBuilder, Action configureLogging)
+ public static IWebHostBuilder ConfigureLogging(this IWebHostBuilder hostBuilder, Action configureLogging)
{
- return hostBuilder.ConfigureLogging((_, loggerFactory) => configureLogging(loggerFactory));
+ return hostBuilder.ConfigureServices(collection => collection.AddLogging(configureLogging));
}
///
@@ -124,24 +124,9 @@ public static IWebHostBuilder ConfigureLogging(this IWebHostBuilder hostBuilder,
/// The to configure.
/// The delegate that configures the .
/// The .
- public static IWebHostBuilder ConfigureLogging(this IWebHostBuilder hostBuilder, Action configureLogging)
- {
- return hostBuilder.ConfigureLogging(configureLogging);
- }
-
- ///
- /// Adds a delegate for configuring the provided . This may be called multiple times.
- ///
- /// The to configure.
- /// The delegate that configures the .
- ///
- /// The type of to configure.
- /// The delegate will not execute if the type provided does not match the used by the .
- ///
- /// The .
- public static IWebHostBuilder ConfigureLogging(this IWebHostBuilder hostBuilder, Action configureLogging) where T : ILoggerFactory
+ public static IWebHostBuilder ConfigureLogging(this IWebHostBuilder hostBuilder, Action configureLogging)
{
- return hostBuilder.ConfigureLogging((_, factory) => configureLogging(factory));
+ return hostBuilder.ConfigureServices((context, collection) => collection.AddLogging(builder => configureLogging(context, builder)));
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Microsoft.AspNetCore.Hosting/breakingchanges.netcore.json b/src/Microsoft.AspNetCore.Hosting/breakingchanges.netcore.json
index 82a7ed22..31999ebe 100644
--- a/src/Microsoft.AspNetCore.Hosting/breakingchanges.netcore.json
+++ b/src/Microsoft.AspNetCore.Hosting/breakingchanges.netcore.json
@@ -12,5 +12,10 @@
"TypeId": "public static class Microsoft.AspNetCore.Hosting.WebHostExtensions",
"MemberId": "public static System.Void Run(this Microsoft.AspNetCore.Hosting.IWebHost host, System.Threading.CancellationToken token)",
"Kind": "Removal"
+ },
+ {
+ "TypeId": "public class Microsoft.AspNetCore.Hosting.WebHostBuilder : Microsoft.AspNetCore.Hosting.IWebHostBuilder",
+ "MemberId": "public Microsoft.AspNetCore.Hosting.IWebHostBuilder UseLoggerFactory(Microsoft.Extensions.Logging.ILoggerFactory loggerFactory)",
+ "Kind": "Removal"
}
-]
\ No newline at end of file
+]
diff --git a/test/Microsoft.AspNetCore.Certificates.Configuration.Tests/Microsoft.AspNetCore.Certificates.Configuration.Tests.csproj b/test/Microsoft.AspNetCore.Certificates.Configuration.Tests/Microsoft.AspNetCore.Certificates.Configuration.Tests.csproj
index a72b7d12..71f5753d 100644
--- a/test/Microsoft.AspNetCore.Certificates.Configuration.Tests/Microsoft.AspNetCore.Certificates.Configuration.Tests.csproj
+++ b/test/Microsoft.AspNetCore.Certificates.Configuration.Tests/Microsoft.AspNetCore.Certificates.Configuration.Tests.csproj
@@ -19,10 +19,12 @@
-
+
+
+
diff --git a/src/Microsoft.AspNetCore.Certificates.Configuration/Properties/AssemblyInfo.cs b/test/Microsoft.AspNetCore.Certificates.Configuration.Tests/Properties/AssemblyInfo.cs
similarity index 58%
rename from src/Microsoft.AspNetCore.Certificates.Configuration/Properties/AssemblyInfo.cs
rename to test/Microsoft.AspNetCore.Certificates.Configuration.Tests/Properties/AssemblyInfo.cs
index 61148132..3337ebea 100644
--- a/src/Microsoft.AspNetCore.Certificates.Configuration/Properties/AssemblyInfo.cs
+++ b/test/Microsoft.AspNetCore.Certificates.Configuration.Tests/Properties/AssemblyInfo.cs
@@ -3,5 +3,4 @@
using System.Runtime.CompilerServices;
-[assembly: InternalsVisibleTo("Microsoft.AspNetCore.Certificates.Configuration.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7")]
\ No newline at end of file
diff --git a/test/Microsoft.AspNetCore.Hosting.TestSites/Program.cs b/test/Microsoft.AspNetCore.Hosting.TestSites/Program.cs
index 191df671..d3e284aa 100644
--- a/test/Microsoft.AspNetCore.Hosting.TestSites/Program.cs
+++ b/test/Microsoft.AspNetCore.Hosting.TestSites/Program.cs
@@ -7,7 +7,9 @@
using Microsoft.AspNetCore.Hosting.Server;
using Microsoft.AspNetCore.Http.Features;
using Microsoft.Extensions.Configuration;
+using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
+using Microsoft.Extensions.Logging.Console;
namespace ServerComparison.TestSites
{
@@ -25,7 +27,7 @@ public static void Main(string[] args)
.ConfigureLogging((_, factory) =>
{
factory.AddConsole();
- factory.AddFilter("Console", level => level >= LogLevel.Warning);
+ factory.AddFilter(level => level >= LogLevel.Warning);
})
.UseStartup("Microsoft.AspNetCore.Hosting.TestSites");
diff --git a/test/Microsoft.AspNetCore.Hosting.Tests/WebHostBuilderTests.cs b/test/Microsoft.AspNetCore.Hosting.Tests/WebHostBuilderTests.cs
index 2ad85e4b..583a231b 100644
--- a/test/Microsoft.AspNetCore.Hosting.Tests/WebHostBuilderTests.cs
+++ b/test/Microsoft.AspNetCore.Hosting.Tests/WebHostBuilderTests.cs
@@ -204,7 +204,6 @@ public void ConfigureDefaultServiceProviderWithContext()
{
Assert.NotNull(context.HostingEnvironment);
Assert.NotNull(context.Configuration);
- Assert.NotNull(context.LoggerFactory);
configurationCallbackCalled = true;
options.ValidateScopes = true;
});
@@ -213,22 +212,6 @@ public void ConfigureDefaultServiceProviderWithContext()
Assert.True(configurationCallbackCalled);
}
- [Fact]
- public void UseLoggerFactoryHonored()
- {
- var loggerFactory = new LoggerFactory();
-
- var hostBuilder = new WebHostBuilder()
- .UseLoggerFactory(loggerFactory)
- .UseServer(new TestServer())
- .UseStartup();
-
- using (var host = (WebHost)hostBuilder.Build())
- {
- Assert.Same(loggerFactory, host.Services.GetService());
- }
- }
-
[Fact]
public void MultipleConfigureLoggingInvokedInOrder()
{
@@ -251,46 +234,6 @@ public void MultipleConfigureLoggingInvokedInOrder()
}
}
- [Fact]
- public void UseLoggerFactoryDelegateIsHonored()
- {
- var loggerFactory = new LoggerFactory();
-
- var hostBuilder = new WebHostBuilder()
- .UseLoggerFactory(_ => loggerFactory)
- .UseServer(new TestServer())
- .UseStartup();
-
- using (var host = (WebHost)hostBuilder.Build())
- {
- Assert.Same(loggerFactory, host.Services.GetService());
- }
- }
-
- [Fact]
- public void UseLoggerFactoryFuncAndConfigureLoggingCompose()
- {
- var callCount = 0; //Verify that multiple configureLogging calls still compose correctly.
- var loggerFactory = new LoggerFactory();
- var hostBuilder = new WebHostBuilder()
- .UseLoggerFactory(_ => loggerFactory)
- .ConfigureLogging(factory =>
- {
- Assert.Equal(0, callCount++);
- })
- .ConfigureLogging(factory =>
- {
- Assert.Equal(1, callCount++);
- })
- .UseServer(new TestServer())
- .UseStartup();
- using (var host = (WebHost)hostBuilder.Build())
- {
- Assert.Equal(2, callCount);
- Assert.Same(loggerFactory, host.Services.GetService());
- }
- }
-
[Fact]
public void HostingContextContainsAppConfigurationDuringConfigureLogging()
{
@@ -331,62 +274,6 @@ public void HostingContextContainsAppConfigurationDuringConfigureServices()
using (hostBuilder.Build()) { }
}
- [Fact]
- public void ConfigureLoggingCalledIfLoggerFactoryTypeMatches()
- {
- var callCount = 0;
- var hostBuilder = new WebHostBuilder()
- .UseLoggerFactory(_ => new SubLoggerFactory())
- .ConfigureLogging(factory =>
- {
- Assert.Equal(0, callCount++);
- })
- .UseServer(new TestServer())
- .UseStartup();
-
- using (hostBuilder.Build())
- {
- Assert.Equal(1, callCount);
- }
- }
-
- [Fact]
- public void ConfigureLoggingNotCalledIfLoggerFactoryTypeDoesNotMatches()
- {
- var callCount = 0;
- var hostBuilder = new WebHostBuilder()
- .UseLoggerFactory(_ => new NonSubLoggerFactory())
- .ConfigureLogging(factory =>
- {
- Assert.Equal(0, callCount++);
- })
- .UseServer(new TestServer())
- .UseStartup();
-
- using (hostBuilder.Build())
- {
- Assert.Equal(0, callCount);
- }
- }
-
- [Fact]
- public void CanUseCustomLoggerFactory()
- {
- var hostBuilder = new WebHostBuilder()
- .UseLoggerFactory(_ => new CustomLoggerFactory())
- .ConfigureLogging(factory =>
- {
- factory.CustomConfigureMethod();
- })
- .UseServer(new TestServer())
- .UseStartup();
-
- using (var host = (WebHost)hostBuilder.Build())
- {
- Assert.IsType(typeof(CustomLoggerFactory), host.Services.GetService());
- }
- }
-
[Fact]
public void ThereIsAlwaysConfiguration()
{
@@ -793,52 +680,6 @@ public void Build_DoesNotAllowBuildingMuiltipleTimes()
}
}
- [Fact]
- public void Build_PassesSameAutoCreatedILoggerFactoryEverywhere()
- {
- var builder = CreateWebHostBuilder();
- var server = new TestServer();
- using (var host = builder.UseServer(server)
- .UseStartup()
- .Build())
- {
- var startup = host.Services.GetService();
- Assert.Equal(startup.ConfigureLoggerFactory, startup.ConstructorLoggerFactory);
- }
- }
-
- [Fact]
- public void Build_PassesSamePassedILoggerFactoryEverywhere()
- {
- var factory = new LoggerFactory();
- var builder = CreateWebHostBuilder();
- var server = new TestServer();
- using (var host = builder.UseServer(server)
- .UseLoggerFactory(factory)
- .UseStartup()
- .Build())
- {
- var startup = host.Services.GetService();
- Assert.Equal(factory, startup.ConfigureLoggerFactory);
- Assert.Equal(factory, startup.ConstructorLoggerFactory);
- }
- }
-
- [Fact]
- public void Build_PassedILoggerFactoryNotDisposed()
- {
- var factory = new DisposableLoggerFactory();
- var builder = CreateWebHostBuilder();
- var server = new TestServer();
-
- using (var host = builder.UseServer(server)
- .UseLoggerFactory(factory)
- .UseStartup()
- .Build()) { }
-
- Assert.False(factory.Disposed);
- }
-
[Fact]
public void Build_DoesNotOverrideILoggerFactorySetByConfigureServices()
{