LayoutRenderer cannot be found: 'aspnet-request' (NLog 2.0 beta 1)

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

LayoutRenderer cannot be found: 'aspnet-request' (NLog 2.0 beta 1)

ARGibson
I have recently upgraded a web application to use NLog 2.0 beta (from 1.0 refresh) and part of my layout makes use of ${aspnet-request} in order to get things like IP and request URL. Since upgrading the application refuses to start and throws the following exception.

LayoutRenderer cannot be found: 'aspnet-request'
   at NLog.Config.Factory`2.CreateInstance(String name) in c:\NLogBuild\src\NLog\Config\Factory.cs:line 170
   at NLog.Layouts.LayoutParser.ParseLayoutRenderer(ConfigurationItemFactory configurationItemFactory, Tokenizer sr) in c:\NLogBuild\src\NLog\Layouts\LayoutParser.cs:line 210
   at NLog.Layouts.LayoutParser.CompileLayout(ConfigurationItemFactory configurationItemFactory, Tokenizer sr, Boolean isNested, String& text) in c:\NLogBuild\src\NLog\Layouts\LayoutParser.cs:line 78
   at NLog.Layouts.SimpleLayout.set_Text(String value) in c:\NLogBuild\src\NLog\Layouts\SimpleLayout.cs:line 113

Now I have made sure that NLog.dll and NLog.Extended.dll and referenced by the application and I can confirm they are loaded. If I remove the ${aspnet-request} layout renders and only use those provided by NLog.dll, the application runs fine.

I am using .NET 4.0 and ASP.NET MVC 2.0. Any ideas?

Thanks,
ANdy
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: LayoutRenderer cannot be found: 'aspnet-request' (NLog 2.0 beta 1)

Mike
Same issue here with .NET4 / MVC2.  Have you had any success?
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: LayoutRenderer cannot be found: 'aspnet-request' (NLog 2.0 beta 1)

Perry
In the NLog2beta1 sourcetree, the aspnet-request renderer is located here:

src\NLog.Extended\LayoutRenderers


I wonder if that means you are missing the NLog.Extended.dll file from your path/GAC/binary directory?
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: LayoutRenderer cannot be found: 'aspnet-request' (NLog 2.0 beta 1)

ARGibson
In reply to this post by ARGibson
As noted in another post (http://nlog-forum.1685105.n2.nabble.com/Problem-with-NLOG-and-ASP-NET-tp5681942p5681942.html;cid=1289401240871-333) the answer to this problem lies in the inclusion of the following lines in your NLog configuration (NLog.Extended.dll must be in the same directory as NLog.dll for this to work, make sure you have it referenced).

<nlog>
  <extensions>
    <add assembly="NLog.Extended" />
  </extensions>

  ...
</nlog>

I never saw any of this in the documentation but I have added it to my application and right enough it now works correctly with the ${aspnet-request} layout renderer.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: LayoutRenderer cannot be found: 'aspnet-request' (NLog 2.0 beta 1)

Jarek Kowalski
Administrator

BTW. In the final version this won't be necessary.

Jarek

NLog Blog
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: LayoutRenderer cannot be found: 'aspnet-request' (NLog 2.0 beta 1)

ARGibson
Ah cool, that is good to know.

Thanks for the update :)
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: LayoutRenderer cannot be found: 'aspnet-request' (NLog 2.0 beta 1)

David De Sloovere
Just a tip, maybe you could add the solution in the exception message. Instead of

"LayoutRenderer cannot be found: 'aspnet-user-identity'"

you could says

"LayoutRenderer cannot be found: 'aspnet-user-identity'. This LayoutRendered might be part of the NLog.Extended assembly. Try adding a reference to NLog.Extended.
Loading...