Migrate middlware docs (#1513)
parent
3e03bf4d1e
commit
bda750bde7
|
@ -168,7 +168,7 @@ For more complex request handling functionality, the ASP.NET team recommends imp
|
|||
.. literalinclude:: middleware/sample/src/MiddlewareSample/RequestLoggerMiddleware.cs
|
||||
:language: c#
|
||||
:caption: RequestLoggerMiddleware.cs
|
||||
:emphasize-lines: 13, 19
|
||||
:emphasize-lines: 12, 18
|
||||
|
||||
The middleware follows the `Explicit Dependencies Principle <http://deviq.com/explicit-dependencies-principle/>`_ and exposes all of its dependencies in its constructor. Middleware can take advantage of the `UseMiddleware<T>`_ extension to inject services directly into their constructors, as shown in the example below. Dependency injected services are automatically filled, and the extension takes a ``params`` array of arguments to be used for non-injected parameters.
|
||||
|
||||
|
|
|
@ -1,6 +1,3 @@
|
|||
{
|
||||
"projects": [ "src", "test" ],
|
||||
"sdk": {
|
||||
"version": "1.0.0-beta6"
|
||||
}
|
||||
"projects": [ "src", "test" ]
|
||||
}
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
using System.IO;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
|
||||
namespace MiddlewareSample
|
||||
{
|
||||
public class Program
|
||||
{
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
var host = new WebHostBuilder()
|
||||
.UseKestrel()
|
||||
.UseContentRoot(Directory.GetCurrentDirectory())
|
||||
.UseIISIntegration()
|
||||
.UseStartup<Startup>()
|
||||
.Build();
|
||||
|
||||
host.Run();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
using Microsoft.AspNet.Builder;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
|
||||
namespace MiddlewareSample
|
||||
{
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
using Microsoft.AspNet.Builder;
|
||||
using Microsoft.AspNet.Http;
|
||||
using Microsoft.Framework.Logging;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace MiddlewareSample
|
||||
{
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
using Microsoft.AspNet.Builder;
|
||||
using Microsoft.AspNet.Hosting;
|
||||
using Microsoft.AspNet.Http;
|
||||
using Microsoft.Framework.DependencyInjection;
|
||||
using Microsoft.Framework.Logging;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace MiddlewareSample
|
||||
{
|
||||
|
|
|
@ -1,2 +0,0 @@
|
|||
server=Microsoft.AspNet.Server.WebListener
|
||||
server.urls=http://localhost:5000
|
|
@ -1,34 +1,22 @@
|
|||
{
|
||||
"webroot": "wwwroot",
|
||||
"version": "1.0.0-*",
|
||||
|
||||
"dependencies": {
|
||||
"Microsoft.AspNet.Server.IIS": "1.0.0-beta6",
|
||||
"Microsoft.AspNet.Server.WebListener": "1.0.0-beta6",
|
||||
"Microsoft.Framework.DependencyInjection": "1.0.0-beta6",
|
||||
"Microsoft.Framework.Logging": "1.0.0-beta6",
|
||||
"Microsoft.Framework.Logging.Console": "1.0.0-beta6"
|
||||
},
|
||||
"Microsoft.NETCore.App": {
|
||||
"version": "1.0.0",
|
||||
"type": "platform"
|
||||
},
|
||||
|
||||
"commands": {
|
||||
"web": "Microsoft.AspNet.Hosting --config hosting.ini"
|
||||
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
|
||||
"Microsoft.AspNetCore.Server.Kestrel": "1.0.0",
|
||||
"Microsoft.Extensions.DependencyInjection": "1.0.0",
|
||||
"Microsoft.Extensions.Logging": "1.0.0",
|
||||
"Microsoft.Extensions.Logging.Console": "1.0.0"
|
||||
},
|
||||
|
||||
"frameworks": {
|
||||
"dnx451": { },
|
||||
"dnxcore50": { }
|
||||
"netcoreapp1.0": {}
|
||||
},
|
||||
|
||||
"publishExclude": [
|
||||
"node_modules",
|
||||
"bower_components",
|
||||
"**.xproj",
|
||||
"**.user",
|
||||
"**.vspscc"
|
||||
],
|
||||
"exclude": [
|
||||
"wwwroot",
|
||||
"node_modules",
|
||||
"bower_components"
|
||||
]
|
||||
"buildOptions": {
|
||||
"emitEntryPoint": true
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue