commit
eae38d749f
Binary file not shown.
Before Width: | Height: | Size: 8.1 KiB |
Binary file not shown.
Before Width: | Height: | Size: 37 KiB |
|
@ -1,32 +0,0 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 14
|
||||
VisualStudioVersion = 14.0.22823.1
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{5FA0FA77-F40F-4BCF-84B9-601475D6ED76}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{14CC5429-5D1D-428E-921B-E9D8FFC9546B}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
global.json = global.json
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "StartupDemo", "src\StartupDemo\StartupDemo.xproj", "{2C04601C-9BF9-47F0-84EB-100399F28A13}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{2C04601C-9BF9-47F0-84EB-100399F28A13}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{2C04601C-9BF9-47F0-84EB-100399F28A13}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{2C04601C-9BF9-47F0-84EB-100399F28A13}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{2C04601C-9BF9-47F0-84EB-100399F28A13}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(NestedProjects) = preSolution
|
||||
{2C04601C-9BF9-47F0-84EB-100399F28A13} = {5FA0FA77-F40F-4BCF-84B9-601475D6ED76}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
|
@ -1,6 +0,0 @@
|
|||
{
|
||||
"projects": [ "src", "test" ],
|
||||
"sdk": {
|
||||
"version": "1.0.0-beta4"
|
||||
}
|
||||
}
|
|
@ -1,17 +0,0 @@
|
|||
{
|
||||
"profiles": {
|
||||
"IIS Express": {
|
||||
"commandName": "IISExpress",
|
||||
"launchBrowser": true,
|
||||
"environmentVariables": {
|
||||
"ASPNET_ENV": "Middleware"
|
||||
}
|
||||
},
|
||||
"web": {
|
||||
"commandName": "web",
|
||||
"environmentVariables": {
|
||||
"ASPNET_ENV": "MapWhen"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,19 +0,0 @@
|
|||
using Microsoft.AspNet.Builder;
|
||||
using Microsoft.AspNet.Hosting;
|
||||
using Microsoft.Framework.DependencyInjection;
|
||||
using Microsoft.Framework.Logging;
|
||||
|
||||
namespace StartupDemo
|
||||
{
|
||||
public static class RequestLoggerExtensions
|
||||
{
|
||||
public static IApplicationBuilder UseRequestLogger(this IApplicationBuilder builder)
|
||||
{
|
||||
var env = builder.ApplicationServices.GetService<IHostingEnvironment>();
|
||||
var loggerFactory = builder.ApplicationServices.GetService<ILoggerFactory>();
|
||||
var logger = loggerFactory.CreateLogger(env.EnvironmentName);
|
||||
|
||||
return builder.Use(next => new RequestLoggerMiddleware(next, logger).Invoke);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,26 +0,0 @@
|
|||
using Microsoft.AspNet.Builder;
|
||||
using Microsoft.AspNet.Http;
|
||||
using Microsoft.Framework.Logging;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StartupDemo
|
||||
{
|
||||
public class RequestLoggerMiddleware
|
||||
{
|
||||
private readonly RequestDelegate _next;
|
||||
private readonly ILogger _logger;
|
||||
|
||||
public RequestLoggerMiddleware(RequestDelegate next, ILogger logger)
|
||||
{
|
||||
_next = next;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public async Task Invoke(HttpContext context)
|
||||
{
|
||||
_logger.LogInformation("Handling request.");
|
||||
await _next.Invoke(context);
|
||||
_logger.LogInformation("Finished handling request.");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,115 +0,0 @@
|
|||
using Microsoft.AspNet.Builder;
|
||||
using Microsoft.AspNet.Hosting;
|
||||
using Microsoft.AspNet.Http;
|
||||
using Microsoft.Framework.DependencyInjection;
|
||||
using Microsoft.Framework.Logging;
|
||||
|
||||
namespace StartupDemo
|
||||
{
|
||||
public class Startup
|
||||
{
|
||||
private readonly string _environment;
|
||||
public Startup(IHostingEnvironment env)
|
||||
{
|
||||
_environment = env.EnvironmentName;
|
||||
}
|
||||
|
||||
public void ConfigureServices(IServiceCollection services)
|
||||
{
|
||||
}
|
||||
|
||||
public void Configure(IApplicationBuilder app)
|
||||
{
|
||||
app.Run(async context =>
|
||||
{
|
||||
await context.Response.WriteAsync("Hello, World!");
|
||||
});
|
||||
|
||||
app.Run(async context =>
|
||||
{
|
||||
await context.Response.WriteAsync("Hello, World, Again!");
|
||||
});
|
||||
}
|
||||
|
||||
public void ConfigureLogInline(IApplicationBuilder app, ILoggerFactory loggerfactory)
|
||||
{
|
||||
loggerfactory.AddConsole(minLevel: LogLevel.Information);
|
||||
var logger = loggerfactory.CreateLogger(_environment);
|
||||
app.Use(async (context, next) =>
|
||||
{
|
||||
logger.LogInformation("Handling request.");
|
||||
await next.Invoke();
|
||||
logger.LogInformation("Finished handling request.");
|
||||
});
|
||||
|
||||
app.Run(async context =>
|
||||
{
|
||||
await context.Response.WriteAsync("Hello from " + _environment);
|
||||
});
|
||||
}
|
||||
|
||||
public void ConfigureLogMiddleware(IApplicationBuilder app,
|
||||
ILoggerFactory loggerfactory)
|
||||
{
|
||||
loggerfactory.AddConsole(minLevel: LogLevel.Information);
|
||||
|
||||
app.UseRequestLogger();
|
||||
|
||||
app.Run(async context =>
|
||||
{
|
||||
await context.Response.WriteAsync("Hello from " + _environment);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public void ConfigureEnvironmentOne(IApplicationBuilder app)
|
||||
{
|
||||
app.Run(async context =>
|
||||
{
|
||||
await context.Response.WriteAsync("Hello from " + _environment);
|
||||
});
|
||||
}
|
||||
|
||||
public void ConfigureEnvironmentTwo(IApplicationBuilder app)
|
||||
{
|
||||
app.Use(next => async context =>
|
||||
{
|
||||
await context.Response.WriteAsync("Hello from " + _environment);
|
||||
});
|
||||
}
|
||||
|
||||
private static void HandleMapTest(IApplicationBuilder app)
|
||||
{
|
||||
app.Run(async context =>
|
||||
{
|
||||
await context.Response.WriteAsync("Map Test Successful");
|
||||
});
|
||||
}
|
||||
|
||||
public void ConfigureMapping(IApplicationBuilder app)
|
||||
{
|
||||
app.Map("/maptest", HandleMapTest);
|
||||
|
||||
}
|
||||
|
||||
private static void HandleBranch(IApplicationBuilder app)
|
||||
{
|
||||
app.Run(async context =>
|
||||
{
|
||||
await context.Response.WriteAsync("Branch used.");
|
||||
});
|
||||
}
|
||||
|
||||
public void ConfigureMapWhen(IApplicationBuilder app)
|
||||
{
|
||||
app.MapWhen(context => {
|
||||
return context.Request.Query.ContainsKey("branch");
|
||||
}, HandleBranch);
|
||||
|
||||
app.Run(async context =>
|
||||
{
|
||||
await context.Response.WriteAsync("Hello from " + _environment);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,19 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
|
||||
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.Props" Condition="'$(VSToolsPath)' != ''" />
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>2c04601c-9bf9-47f0-84eb-100399f28a13</ProjectGuid>
|
||||
<RootNamespace>StartupDemo</RootNamespace>
|
||||
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
|
||||
<OutputPath Condition="'$(OutputPath)'=='' ">..\..\artifacts\bin\$(MSBuildProjectName)\</OutputPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<DevelopmentServerPort>4330</DevelopmentServerPort>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.targets" Condition="'$(VSToolsPath)' != ''" />
|
||||
</Project>
|
|
@ -1,34 +0,0 @@
|
|||
{
|
||||
"webroot": "wwwroot",
|
||||
"version": "1.0.0-*",
|
||||
|
||||
"dependencies": {
|
||||
"Microsoft.AspNet.Server.IIS": "1.0.0-beta4",
|
||||
"Microsoft.AspNet.Server.WebListener": "1.0.0-beta4",
|
||||
"Microsoft.Framework.DependencyInjection": "1.0.0-beta4",
|
||||
"Microsoft.Framework.Logging": "1.0.0-beta4",
|
||||
"Microsoft.Framework.Logging.Console": "1.0.0-beta4"
|
||||
},
|
||||
|
||||
"commands": {
|
||||
"web": "Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.WebListener --server.urls http://localhost:5000"
|
||||
},
|
||||
|
||||
"frameworks": {
|
||||
"dnx451": { },
|
||||
"dnxcore50": { }
|
||||
},
|
||||
|
||||
"publishExclude": [
|
||||
"node_modules",
|
||||
"bower_components",
|
||||
"**.xproj",
|
||||
"**.user",
|
||||
"**.vspscc"
|
||||
],
|
||||
"exclude": [
|
||||
"wwwroot",
|
||||
"node_modules",
|
||||
"bower_components"
|
||||
]
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>Sample</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Sample</h1>
|
||||
<p>Added so the wwwroot folder gets checked in.</p>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue