From 821e13a1a7526b719a2c680e742781b36cfd4b02 Mon Sep 17 00:00:00 2001 From: Levi B Date: Fri, 10 Oct 2014 12:13:58 -0700 Subject: [PATCH] Update Hosting to account for DataProtection API changes. --- src/Microsoft.AspNet.Hosting/HostingServices.cs | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/src/Microsoft.AspNet.Hosting/HostingServices.cs b/src/Microsoft.AspNet.Hosting/HostingServices.cs index 6bedf61f50..dbf5c26adc 100644 --- a/src/Microsoft.AspNet.Hosting/HostingServices.cs +++ b/src/Microsoft.AspNet.Hosting/HostingServices.cs @@ -41,19 +41,9 @@ namespace Microsoft.AspNet.Hosting yield return describer.Scoped(typeof(IContextAccessor<>), typeof(ContextAccessor<>)); - if (PlatformHelper.IsMono) + foreach (var service in DataProtectionServices.GetDefaultServices()) { -#if ASPNET50 - yield return describer.Instance(DataProtectionProvider.CreateFromLegacyDpapi()); -#endif - } - else - { - // The default IDataProtectionProvider is a singleton. - // Note: DPAPI isn't usable in IIS where the user profile hasn't been loaded, but loading DPAPI - // is deferred until the first call to Protect / Unprotect. It's up to an IIS-based host to - // replace this service as part of application initialization. - yield return describer.Instance(DataProtectionProvider.CreateFromDpapi()); + yield return service; } } }