Skip to content
This repository has been archived by the owner on Dec 8, 2018. It is now read-only.

Commit

Permalink
Reacting to new Hosting API
Browse files Browse the repository at this point in the history
  • Loading branch information
JunTaoLuo committed Dec 18, 2015
1 parent e384b7d commit c476f91
Show file tree
Hide file tree
Showing 35 changed files with 572 additions and 349 deletions.
16 changes: 13 additions & 3 deletions samples/DatabaseErrorPageSample/Startup.cs
@@ -1,9 +1,9 @@
using System;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNet.Builder;
using Microsoft.AspNet.Hosting;
using Microsoft.Data.Entity;
using System.Linq;
using Microsoft.Extensions.DependencyInjection;
using System.Threading.Tasks;

namespace DatabaseErrorPageSample
{
Expand All @@ -26,6 +26,16 @@ public void Configure(IApplicationBuilder app)
return Task.FromResult(0);
});
}

public static void Main(string[] args)
{
var application = new WebApplicationBuilder()
.UseConfiguration(WebApplicationConfiguration.GetDefault(args))
.UseStartup<Startup>()
.Build();

application.Run();
}
}

public class MyContext : DbContext
Expand Down
3 changes: 3 additions & 0 deletions samples/DatabaseErrorPageSample/hosting.json
@@ -0,0 +1,3 @@
{
"server": "Microsoft.AspNet.Server.Kestrel"
}
8 changes: 4 additions & 4 deletions samples/DatabaseErrorPageSample/project.json
@@ -1,15 +1,15 @@
{
"webroot": "wwwroot",
"dependencies": {
"Microsoft.AspNet.Diagnostics.Entity": "7.0.0-*",
"EntityFramework.MicrosoftSqlServer": "7.0.0-*",
"EntityFramework.Commands": "7.0.0-*",
"Microsoft.AspNet.Server.WebListener": "1.0.0-*",
"Microsoft.AspNet.Server.Kestrel": "1.0.0-*"
},
"compilationOptions": {
"emitEntryPoint": true
},
"commands": {
"ef": "EntityFramework.Commands",
"web": "Microsoft.AspNet.Server.Kestrel"
"web": "DatabaseErrorPageSample"
},
"frameworks": {
"dnx451": { },
Expand Down
11 changes: 11 additions & 0 deletions samples/DeveloperExceptionPageSample/Startup.cs
@@ -1,5 +1,6 @@
using System;
using Microsoft.AspNet.Builder;
using Microsoft.AspNet.Hosting;

namespace DeveloperExceptionPageSample
{
Expand All @@ -17,5 +18,15 @@ public void Configure(IApplicationBuilder app)
"New Line 3"));
});
}

public static void Main(string[] args)
{
var application = new WebApplicationBuilder()
.UseConfiguration(WebApplicationConfiguration.GetDefault(args))
.UseStartup<Startup>()
.Build();

application.Run();
}
}
}
3 changes: 3 additions & 0 deletions samples/DeveloperExceptionPageSample/hosting.json
@@ -0,0 +1,3 @@
{
"server": "Microsoft.AspNet.Server.Kestrel"
}
11 changes: 7 additions & 4 deletions samples/DeveloperExceptionPageSample/project.json
@@ -1,11 +1,14 @@
{
"webroot" : "wwwroot",
"dependencies": {
"Microsoft.AspNet.Diagnostics": "1.0.0-*",
"Microsoft.AspNet.Server.WebListener": "1.0.0-*",
"Microsoft.AspNet.Server.IIS": "1.0.0-*"
"Microsoft.AspNet.Server.Kestrel": "1.0.0-*"
},
"compilationOptions": {
"emitEntryPoint": true
},
"commands": {
"web": "DeveloperExceptionPageSample"
},
"commands": { "web": "Microsoft.AspNet.Hosting server=Microsoft.AspNet.Server.WebListener server.urls=http://localhost:5001" },
"frameworks": {
"dnx451": {},
"dnxcore50": {}
Expand Down
9 changes: 9 additions & 0 deletions samples/DeveloperExceptionPageSample/wwwroot/web.config
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="httpPlatformHandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified" />
</handlers>
<httpPlatform processPath="%DNX_PATH%" arguments="%DNX_ARGS%" forwardWindowsAuthToken="false" startupTimeLimit="3600" />
</system.webServer>
</configuration>
11 changes: 11 additions & 0 deletions samples/ElmPageSample/Startup.cs
Expand Up @@ -2,6 +2,7 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using Microsoft.AspNet.Builder;
using Microsoft.AspNet.Hosting;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;

Expand All @@ -27,5 +28,15 @@ public void Configure(IApplicationBuilder app)

app.UseMiddleware<HelloWorldMiddleware>();
}

public static void Main(string[] args)
{
var application = new WebApplicationBuilder()
.UseConfiguration(WebApplicationConfiguration.GetDefault(args))
.UseStartup<Startup>()
.Build();

application.Run();
}
}
}
3 changes: 3 additions & 0 deletions samples/ElmPageSample/hosting.json
@@ -0,0 +1,3 @@
{
"server": "Microsoft.AspNet.Server.Kestrel"
}
29 changes: 15 additions & 14 deletions samples/ElmPageSample/project.json
@@ -1,16 +1,17 @@
{
"webroot": "wwwroot",
"exclude": "wwwroot/**/*.*",
"dependencies": {
"Microsoft.AspNet.Diagnostics.Elm": "1.0.0-*",
"Microsoft.AspNet.Server.IIS": "1.0.0-*",
"Microsoft.AspNet.Server.WebListener": "1.0.0-*"
},
"commands": {
"web": "Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.WebListener --server.urls http://localhost:5000"
},
"frameworks": {
"dnx451" : { },
"dnxcore50" : { }
}
"exclude": "wwwroot/**/*.*",
"dependencies": {
"Microsoft.AspNet.Diagnostics.Elm": "1.0.0-*",
"Microsoft.AspNet.Server.Kestrel": "1.0.0-*"
},
"compilationOptions": {
"emitEntryPoint": true
},
"commands": {
"web": "ElmPageSample"
},
"frameworks": {
"dnx451": { },
"dnxcore50": { }
}
}
9 changes: 9 additions & 0 deletions samples/ElmPageSample/wwwroot/web.config
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="httpPlatformHandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified" />
</handlers>
<httpPlatform processPath="%DNX_PATH%" arguments="%DNX_ARGS%" forwardWindowsAuthToken="false" startupTimeLimit="3600" />
</system.webServer>
</configuration>
11 changes: 11 additions & 0 deletions samples/ExceptionHandlerSample/Startup.cs
Expand Up @@ -2,6 +2,7 @@
using System.Text.Encodings.Web;
using Microsoft.AspNet.Builder;
using Microsoft.AspNet.Diagnostics;
using Microsoft.AspNet.Hosting;
using Microsoft.AspNet.Http;
using Microsoft.AspNet.Http.Features;

Expand Down Expand Up @@ -54,5 +55,15 @@ public void Configure(IApplicationBuilder app)
await context.Response.WriteAsync("</body></html>\r\n");
});
}

public static void Main(string[] args)
{
var application = new WebApplicationBuilder()
.UseConfiguration(WebApplicationConfiguration.GetDefault(args))
.UseStartup<Startup>()
.Build();

application.Run();
}
}
}
3 changes: 3 additions & 0 deletions samples/ExceptionHandlerSample/hosting.json
@@ -0,0 +1,3 @@
{
"server": "Microsoft.AspNet.Server.Kestrel"
}
31 changes: 16 additions & 15 deletions samples/ExceptionHandlerSample/project.json
@@ -1,17 +1,18 @@
{
"webroot": "wwwroot",
"exclude": "wwwroot/**/*.*",
"dependencies": {
"Microsoft.AspNet.Diagnostics": "1.0.0-*",
"Microsoft.AspNet.Server.IIS": "1.0.0-*",
"Microsoft.AspNet.Server.WebListener": "1.0.0-*",
"Microsoft.AspNet.StaticFiles": "1.0.0-*"
},
"commands": {
"web": "Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.WebListener --server.urls http://localhost:5000"
},
"frameworks": {
"dnx451" : { },
"dnxcore50" : { }
}
"exclude": "wwwroot/**/*.*",
"dependencies": {
"Microsoft.AspNet.Diagnostics": "1.0.0-*",
"Microsoft.AspNet.Server.Kestrel": "1.0.0-*",
"Microsoft.AspNet.StaticFiles": "1.0.0-*"
},
"compilationOptions": {
"emitEntryPoint": true
},
"commands": {
"web": "ExceptionHandlerSample"
},
"frameworks": {
"dnx451": { },
"dnxcore50": { }
}
}
9 changes: 9 additions & 0 deletions samples/ExceptionHandlerSample/wwwroot/web.config
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="httpPlatformHandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified" />
</handlers>
<httpPlatform processPath="%DNX_PATH%" arguments="%DNX_ARGS%" forwardWindowsAuthToken="false" startupTimeLimit="3600" />
</system.webServer>
</configuration>
11 changes: 11 additions & 0 deletions samples/MiddlewareAnalysisSample/Startup.cs
@@ -1,6 +1,7 @@
using System;
using System.Diagnostics;
using Microsoft.AspNet.Builder;
using Microsoft.AspNet.Hosting;
using Microsoft.AspNet.Http;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DiagnosticAdapter;
Expand Down Expand Up @@ -82,6 +83,16 @@ public void Configure(IApplicationBuilder app, ILoggerFactory factory, Diagnosti
// Note there's always a default 404 middleware at the end of the pipeline.
}

public static void Main(string[] args)
{
var application = new WebApplicationBuilder()
.UseConfiguration(WebApplicationConfiguration.GetDefault(args))
.UseStartup<Startup>()
.Build();

application.Run();
}

public class TestDiagnosticListener
{
[DiagnosticName("Microsoft.AspNet.MiddlewareAnalysis.MiddlewareStarting")]
Expand Down
3 changes: 3 additions & 0 deletions samples/MiddlewareAnalysisSample/hosting.json
@@ -0,0 +1,3 @@
{
"server": "Microsoft.AspNet.Server.Kestrel"
}
7 changes: 4 additions & 3 deletions samples/MiddlewareAnalysisSample/project.json
Expand Up @@ -4,13 +4,14 @@
"Microsoft.AspNet.IISPlatformHandler": "1.0.0-*",
"Microsoft.AspNet.MiddlewareAnalysis": "1.0.0-*",
"Microsoft.AspNet.Server.Kestrel": "1.0.0-*",
"Microsoft.AspNet.Server.WebListener": "1.0.0-*",
"Microsoft.Extensions.DiagnosticAdapter": "1.0.0-*",
"Microsoft.Extensions.Logging.Console": "1.0.0-*"
},
"compilationOptions": {
"emitEntryPoint": true
},
"commands": {
"web": "Microsoft.AspNet.Server.Kestrel",
"weblistener": "Microsoft.AspNet.Server.WebListener"
"web": "MiddlewareAnalysisSample"
},
"frameworks": {
"dnx451": { },
Expand Down
9 changes: 9 additions & 0 deletions samples/MiddlewareAnalysisSample/wwwroot/web.config
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="httpPlatformHandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified" />
</handlers>
<httpPlatform processPath="%DNX_PATH%" arguments="%DNX_ARGS%" forwardWindowsAuthToken="false" startupTimeLimit="3600" />
</system.webServer>
</configuration>
16 changes: 12 additions & 4 deletions samples/RuntimeInfoPageSample/Startup.cs
@@ -1,8 +1,6 @@
using System;
using System.Threading.Tasks;
using System.Threading.Tasks;
using Microsoft.AspNet.Builder;
using Microsoft.AspNet.Diagnostics;
using Microsoft.AspNet.Http;
using Microsoft.AspNet.Hosting;

namespace RuntimeInfoPageSample
{
Expand All @@ -20,5 +18,15 @@ public void Configure(IApplicationBuilder app)
return Task.FromResult(0);
});
}

public static void Main(string[] args)
{
var application = new WebApplicationBuilder()
.UseConfiguration(WebApplicationConfiguration.GetDefault(args))
.UseStartup<Startup>()
.Build();

application.Run();
}
}
}
3 changes: 3 additions & 0 deletions samples/RuntimeInfoPageSample/hosting.json
@@ -0,0 +1,3 @@
{
"server": "Microsoft.AspNet.Server.Kestrel"
}
25 changes: 15 additions & 10 deletions samples/RuntimeInfoPageSample/project.json
@@ -1,12 +1,17 @@
{
"webroot" : "wwwroot",
"exclude": "wwwroot/**/*.*",
"dependencies": {
"Microsoft.AspNet.Diagnostics": "",
"Microsoft.AspNet.Server.IIS": "1.0.0-*"
},
"frameworks" : {
"dnx451" : { },
"dnxcore50" : { }
}
"exclude": "wwwroot/**/*.*",
"dependencies": {
"Microsoft.AspNet.Diagnostics": "",
"Microsoft.AspNet.Server.Kestrel": "1.0.0-*"
},
"compilationOptions": {
"emitEntryPoint": true
},
"commands": {
"web": "RuntimeInfoPageSample"
},
"frameworks": {
"dnx451": { },
"dnxcore50": { }
}
}
11 changes: 11 additions & 0 deletions samples/StatusCodePagesSample/Startup.cs
Expand Up @@ -8,6 +8,7 @@
using System.Threading.Tasks;
using Microsoft.AspNet.Builder;
using Microsoft.AspNet.Diagnostics;
using Microsoft.AspNet.Hosting;
using Microsoft.AspNet.Http;
using Microsoft.AspNet.Http.Features;

Expand Down Expand Up @@ -100,5 +101,15 @@ public void Configure(IApplicationBuilder app)
await context.Response.WriteAsync(builder.ToString());
});
}

public static void Main(string[] args)
{
var application = new WebApplicationBuilder()
.UseConfiguration(WebApplicationConfiguration.GetDefault(args))
.UseStartup<Startup>()
.Build();

application.Run();
}
}
}

0 comments on commit c476f91

Please sign in to comment.