diff --git a/src/Microsoft.AspNet.Hosting/Program.cs b/src/Microsoft.AspNet.Hosting/Program.cs index d96fb4f131..801041bdc0 100644 --- a/src/Microsoft.AspNet.Hosting/Program.cs +++ b/src/Microsoft.AspNet.Hosting/Program.cs @@ -5,6 +5,7 @@ using System; using System.IO; using System.Threading; using System.Threading.Tasks; +using Microsoft.AspNet.Security.DataProtection; using Microsoft.Framework.ConfigurationModel; using Microsoft.Framework.DependencyInjection; using Microsoft.Framework.DependencyInjection.Fallback; @@ -46,6 +47,14 @@ namespace Microsoft.AspNet.Hosting var serviceCollection = new ServiceCollection(); serviceCollection.Add(HostingServices.GetDefaultServices(config)); serviceCollection.AddInstance(hostingEnv); + // The application name is a "good enough" mechanism to identify this application + // on the machine and to prevent subkeys from being shared across multiple applications + // by default. + serviceCollection.ConfigureOptions(options => + { + options.ApplicationDiscriminator = appEnv.ApplicationName; + }); + var services = serviceCollection.BuildServiceProvider(_serviceProvider); var context = new HostingContext()