This commit is contained in:
Praburaj 2014-12-22 19:04:55 -08:00
Родитель 9e62865dd9
Коммит d9148bd6f7
4 изменённых файлов: 30 добавлений и 42 удалений

Просмотреть файл

@ -1,43 +1,31 @@
# MusicStore application
This project is part of ASP.NET vNext. You can find samples, documentation and getting started instructions for ASP.NET vNext at the [Home](https://github.com/aspnet/home) repo.
This project is part of ASP.NET 5.0. You can find samples, documentation and getting started instructions for ASP.NET 5.0 at the [Home](https://github.com/aspnet/home) repo.
* Clone the repository
### Run the application on Helios:
## Run the application on Helios:
* If you have Visual Studio 2015
1. Open MusicStore.sln in Visual Studio 2015 and run the individual applications on ```Helios```.
1. Open MusicStore.sln in Visual Studio 2015 and run the individual applications on `IIS Express`.
* If you don't have Visual Studio 2015
1. Open a command prompt and cd ```\src\MusicStore\```
2. Execute ``kpm restore```
3. Execute ```Helios.cmd``` to launch the app on IISExpress from command line (Application started at URL **http://localhost:5001/**).
NOTE: App and Tests require Visual Studio 2015 LocalDB on the machine to run. Please change the connection string if you don't have Visual studio 2015 installed.
1. Open a command prompt and cd `\src\MusicStore\`.
2. Execute `kpm restore`.
3. Execute `Helios.cmd` to launch the app on IISExpress from command line (Application started at URL **http://localhost:5001/**).
NOTE: App and tests require Visual Studio 2015 LocalDB on the machine to run.
### Run on WebListener/Kestrel:
* Open a command prompt and cd ```\src\MusicStore\```
## Run on WebListener/Kestrel:
* Open a command prompt and cd `\src\MusicStore\`.
* **[WebListener]:**
4. Run ```k WebListener``` (Application started at URL **http://localhost:5002/**)
4. Run `k WebListener` (Application started at URL **http://localhost:5002/**).
* **[Kestrel]:**
5. Run ```k Kestrel``` (Application started at URL **http://localhost:5004/**)
5. Run `k Kestrel` (Application started at URL **http://localhost:5004/**).
* **[CustomHost]:**
6. Run ```k run``` (This hosts the app in a console application - Application started at URL **http://localhost:5003/**)
6. Run `k run` (This hosts the app in a console application - Application started at URL **http://localhost:5003/**).
### To run the sample on Mac/Mono:
* Follow [Home](https://github.com/aspnet/home) instructions to install mono, kvm on Mac
* Open a command prompt and cd ```\src\MusicStore\```
* Execute ```kpm restore```
* Try `k kestrel` to run the application
## To run the sample on Mac/Mono:
* Follow [Home](https://github.com/aspnet/home) instructions to install mono, kvm on Mac.
* Open a command prompt and cd `\src\MusicStore\`.
* Execute `kpm restore`.
* Try `k kestrel` to run the application.
**NOTE: On Mono since SQL client is not available the sample uses an InMemoryStore to run the application. So the changes that you make will not be persisted.
### Run Tests:
* Open a command prompt and cd ```\test\E2ETests\```
* Execute ```kpm restore```
* Set KRE_ENV environment variable to "SocialTesting"
* Run ```k test```
###NTLM authentication
More information at src/MusicStore/StartupNtlmAuthentication.cs
**NOTE: Ntlm authentication works only on desktop CLR right now.
### Note:
1. Application is started on different ports on different hosts. To change the port or URL modify ```Helios.cmd``` or project.json commands section in case of self-host and customhost.
More information at src/MusicStore/StartupNtlmAuthentication.cs.

Просмотреть файл

@ -84,7 +84,7 @@ namespace MusicStore
services.AddSingleton<IMemoryCache, MemoryCache>();
}
//This method is invoked when KRE_ENV is 'Development' or is not defined
//This method is invoked when ASPNET_ENV is 'Development' or is not defined
//The allowed values are Development,Staging and Production
public void ConfigureDevelopment(IApplicationBuilder app)
{
@ -100,7 +100,7 @@ namespace MusicStore
Configure(app);
}
//This method is invoked when KRE_ENV is 'Staging'
//This method is invoked when ASPNET_ENV is 'Staging'
//The allowed values are Development,Staging and Production
public void ConfigureStaging(IApplicationBuilder app)
{
@ -108,7 +108,7 @@ namespace MusicStore
Configure(app);
}
//This method is invoked when KRE_ENV is 'Production'
//This method is invoked when ASPNET_ENV is 'Production'
//The allowed values are Development,Staging and Production
public void ConfigureProduction(IApplicationBuilder app)
{

Просмотреть файл

@ -16,14 +16,14 @@ namespace MusicStore
/// <summary>
/// To make runtime to load an environment based startup class, specify the environment by the following ways:
/// 1. Drop a Microsoft.AspNet.Hosting.ini file in the application folder
/// 2. Add a setting in the ini file named 'KRE_ENV' with value of the format 'Startup[EnvironmentName]'. For example: To load a Startup class named
/// 'StartupNtlmAuthentication' the value of the env should be 'NtlmAuthentication' (eg. KRE_ENV=NtlmAuthentication). Runtime adds a 'Startup' prefix to this and loads 'StartupNtlmAuthentication'.
/// 2. Add a setting in the ini file named 'ASPNET_ENV' with value of the format 'Startup[EnvironmentName]'. For example: To load a Startup class named
/// 'StartupNtlmAuthentication' the value of the env should be 'NtlmAuthentication' (eg. ASPNET_ENV=NtlmAuthentication). Runtime adds a 'Startup' prefix to this and loads 'StartupNtlmAuthentication'.
/// If no environment name is specified the default startup class loaded is 'Startup'.
/// Alternative ways to specify environment are:
/// 1. Set the environment variable named SET KRE_ENV=NtlmAuthentication
/// 1. Set the environment variable named SET ASPNET_ENV=NtlmAuthentication
/// 2. For selfhost based servers pass in a command line variable named --env with this value. Eg:
/// "commands": {
/// "WebListener": "Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.WebListener --server.urls http://localhost:5002 --KRE_ENV NtlmAuthentication",
/// "WebListener": "Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.WebListener --server.urls http://localhost:5002 --ASPNET_ENV NtlmAuthentication",
/// },
/// </summary>
public class StartupNtlmAuthentication

Просмотреть файл

@ -70,7 +70,7 @@ namespace E2ETests
startParameters.ServerType != ServerType.IIS)
{
// To choose an environment based Startup.
Environment.SetEnvironmentVariable("KRE_ENV", startParameters.EnvironmentName);
Environment.SetEnvironmentVariable("ASPNET_ENV", startParameters.EnvironmentName);
}
else
{
@ -99,10 +99,10 @@ namespace E2ETests
// Pack to IIS root\application folder.
KpmPack(startParameters, Path.Combine(Environment.GetEnvironmentVariable("SystemDrive") + @"\", @"inetpub\wwwroot"));
// Drop a Microsoft.AspNet.Hosting.ini with KRE_ENV information.
Console.WriteLine("Creating Microsoft.AspNet.Hosting.ini file with KRE_ENV.");
// Drop a Microsoft.AspNet.Hosting.ini with ASPNET_ENV information.
Console.WriteLine("Creating Microsoft.AspNet.Hosting.ini file with ASPNET_ENV.");
var iniFile = Path.Combine(startParameters.ApplicationPath, "Microsoft.AspNet.Hosting.ini");
File.WriteAllText(iniFile, string.Format("KRE_ENV={0}", startParameters.EnvironmentName));
File.WriteAllText(iniFile, string.Format("ASPNET_ENV={0}", startParameters.EnvironmentName));
// Can't use localdb with IIS. Setting an override to use InMemoryStore.
Console.WriteLine("Creating configoverride.json file to override default config.");
@ -157,7 +157,7 @@ namespace E2ETests
//Restore the KRE_DEFAULT_LIB after starting the host process
Environment.SetEnvironmentVariable("KRE_DEFAULT_LIB", backupKreDefaultLibPath);
Environment.SetEnvironmentVariable("KRE_ENV", string.Empty);
Environment.SetEnvironmentVariable("ASPNET_ENV", string.Empty);
return hostProcess;
}