Skip to content

Commit

Permalink
Merge pull request #36 from NLog/304NotModified-update-readme-aspnet5
Browse files Browse the repository at this point in the history
Update README for aspnet5
  • Loading branch information
304NotModified committed Feb 16, 2016
2 parents 639d0d7 + ed48624 commit 4e3ec4d
Showing 1 changed file with 37 additions and 3 deletions.
40 changes: 37 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

ASP.NET 4: [![Version](https://img.shields.io/nuget/v/NLog.Web.svg)](https://www.nuget.org/packages/NLog.Web)

ASP.NET 5: [![Version](https://img.shields.io/nuget/v/NLog.Web.ASPNET5.svg)](https://www.nuget.org/packages/NLog.Web.ASPNET5) (note: not working yet due to DI issues)
ASP.NET 5: [![Version](https://img.shields.io/nuget/v/NLog.Web.ASPNET5.svg)](https://www.nuget.org/packages/NLog.Web.ASPNET5)

[![AppVeyor](https://img.shields.io/appveyor/ci/nlog/nlog-web/master.svg)](https://ci.appveyor.com/project/nlog/nlog-web/branch/master)
[![codecov.io](https://codecov.io/github/NLog/NLog.Web/coverage.svg?branch=master)](https://codecov.io/github/NLog/NLog.Web?branch=master)
Expand All @@ -13,8 +13,6 @@ This package contains
targets and layout-renderes specific to ASP.Net and IIS.

##ASP.NET 5
(note: not working yet due to DI issues)

There is a special package for ASP.NET 5 / MVC 6. This is needed because `HttpContext.Current` isn't available in ASP.NET 5 and we can't detect if ASP.NET 4 or 5 is used.

The following parts are supported in ASP.NET 5:
Expand All @@ -26,6 +24,42 @@ The following parts are supported in ASP.NET 5:
* aspnet-user-identity
* iis-site-name

###Usage

In your nlog.config:

```xml
<extensions>
<!--enable NLog.Web for ASP.NET5-->
<add assembly="NLog.Web.ASPNET5"/>
</extensions>
```

In your startup.cs

```c#
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
//add NLog to aspnet5
loggerFactory.AddNLog();

//add NLog.Web (only needed if NLog.Web.ASPNET5 is needed)
app.AddNLogWeb();

//configure nlog.config in your project root
env.ConfigureNLog("nlog.config");
```
in project.json:

```json
"dependencies": {
...
"NLog.Extensions.Logging": "1.0.0-rc1-final-2016-02-06",
"NLog.Web.ASPNET5": "4.2.1"
},
```

##Content
This package contains one target, one target-wrapper, multiple layout renderers and one httpmodule.

Expand Down

0 comments on commit 4e3ec4d

Please sign in to comment.